From a93a86023180c1870e09cd05818f4adfee0b50eb Mon Sep 17 00:00:00 2001 From: Morten Priess Date: Mon, 5 Sep 2022 13:45:54 +0200 Subject: [PATCH] Bluetooth: controller: Fix ISO Test Mode SDU counting for framed For framed case, the internal RX SDU counter would increment regardless of whether the first valid SDU was received or not. According to spec, SDU counter synchronization is done from first valid SDU. Signed-off-by: Morten Priess --- subsys/bluetooth/controller/ll_sw/ull_iso.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/subsys/bluetooth/controller/ll_sw/ull_iso.c b/subsys/bluetooth/controller/ll_sw/ull_iso.c index 6ce614dcf0a..dc30331e1e1 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_iso.c +++ b/subsys/bluetooth/controller/ll_sw/ull_iso.c @@ -742,7 +742,12 @@ static isoal_status_t ll_iso_test_sdu_emit(const struct isoal_sink * break; } - if (framed) { + /* In framed mode, we may start incrementing the SDU counter when rx_sdu_counter + * becomes non zero (initial state), or in case of zero-based counting, if zero + * is actually the first valid SDU counter received. + */ + if (framed && (cis->hdr.test_mode.rx_sdu_counter || + (sdu_frag->sdu.status == ISOAL_SDU_STATUS_VALID))) { cis->hdr.test_mode.rx_sdu_counter++; }