Bluetooth: Controller: Fix lost_payloads calculation for FT > 1

The lost_payloads calculation in ull_conn_iso_start() could easily
end up negative for CIS with FT > 1; Add a check to avoid this

Signed-off-by: Troels Nilsson <trnn@demant.com>
This commit is contained in:
Troels Nilsson 2025-03-12 12:53:30 +01:00 committed by Benjamin Cabé
commit a87e8dce7d

View file

@ -977,10 +977,20 @@ void ull_conn_iso_start(struct ll_conn *conn, uint16_t cis_handle,
cis->lll.event_count_prepare += lost_cig_events; cis->lll.event_count_prepare += lost_cig_events;
lost_payloads = (lost_cig_events - (cis->lll.rx.ft - 1)) * cis->lll.rx.bn; if (lost_cig_events > (cis->lll.rx.ft - 1)) {
lost_payloads = (lost_cig_events - (cis->lll.rx.ft - 1)) *
cis->lll.rx.bn;
} else {
lost_payloads = 0U;
}
cis->lll.rx.payload_count += lost_payloads; cis->lll.rx.payload_count += lost_payloads;
lost_payloads = (lost_cig_events - (cis->lll.tx.ft - 1)) * cis->lll.tx.bn; if (lost_cig_events > (cis->lll.tx.ft - 1)) {
lost_payloads = (lost_cig_events - (cis->lll.tx.ft - 1)) *
cis->lll.tx.bn;
} else {
lost_payloads = 0U;
}
cis->lll.tx.payload_count += lost_payloads; cis->lll.tx.payload_count += lost_payloads;
/* Adjust for extra window widening */ /* Adjust for extra window widening */