Skip to content

Commit

Permalink
Bluetooth: Controller: Fix regression in connection update
Browse files Browse the repository at this point in the history
The connection event at the connection update instant was
skipped due to previous ticker node in use that is being
stopped was registering a relative occupied time that
overlapped with the new ticker node being started for
scheduling the connection with new interval.

Added mock interface for ticker_stop_abs() hence needed by
the Controller unit testing.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
(cherry picked from commit 5dffad0)
  • Loading branch information
cvinayak committed Jan 21, 2025
1 parent 7d2ac02 commit 7f08cdf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 3 additions & 2 deletions subsys/bluetooth/controller/ll_sw/ull_conn.c
Original file line number Diff line number Diff line change
Expand Up @@ -2179,8 +2179,9 @@ static void ull_conn_update_ticker(struct ll_conn *conn,

/* start periph/central with new timings */
uint8_t ticker_id_conn = TICKER_ID_CONN_BASE + ll_conn_handle_get(conn);
uint32_t ticker_status = ticker_stop(TICKER_INSTANCE_ID_CTLR, TICKER_USER_ID_ULL_HIGH,
ticker_id_conn, ticker_stop_conn_op_cb, (void *)conn);
uint32_t ticker_status = ticker_stop_abs(TICKER_INSTANCE_ID_CTLR, TICKER_USER_ID_ULL_HIGH,
ticker_id_conn, ticks_at_expire,
ticker_stop_conn_op_cb, (void *)conn);
LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||

Check notice on line 2185 in subsys/bluetooth/controller/ll_sw/ull_conn.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

subsys/bluetooth/controller/ll_sw/ull_conn.c:2185 - uint32_t ticker_status = ticker_stop_abs(TICKER_INSTANCE_ID_CTLR, TICKER_USER_ID_ULL_HIGH, - ticker_id_conn, ticks_at_expire, - ticker_stop_conn_op_cb, (void *)conn); + uint32_t ticker_status = + ticker_stop_abs(TICKER_INSTANCE_ID_CTLR, TICKER_USER_ID_ULL_HIGH, ticker_id_conn, + ticks_at_expire, ticker_stop_conn_op_cb, (void *)conn);
(ticker_status == TICKER_STATUS_BUSY));
ticker_status = ticker_start(
Expand Down
7 changes: 7 additions & 0 deletions tests/bluetooth/controller/mock_ctrl/src/ticker.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ uint8_t ticker_stop(uint8_t instance_index, uint8_t user_id, uint8_t ticker_id,
return TICKER_STATUS_SUCCESS;
}

uint8_t ticker_stop_abs(uint8_t instance_index, uint8_t user_id,
uint8_t ticker_id, uint32_t ticks_at_stop,
ticker_op_func fp_op_func, void *op_context)
{

Check notice on line 39 in tests/bluetooth/controller/mock_ctrl/src/ticker.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

tests/bluetooth/controller/mock_ctrl/src/ticker.c:39 -uint8_t ticker_stop_abs(uint8_t instance_index, uint8_t user_id, - uint8_t ticker_id, uint32_t ticks_at_stop, - ticker_op_func fp_op_func, void *op_context) +uint8_t ticker_stop_abs(uint8_t instance_index, uint8_t user_id, uint8_t ticker_id, + uint32_t ticks_at_stop, ticker_op_func fp_op_func, void *op_context)
return TICKER_STATUS_SUCCESS;
}

void ticker_job_sched(uint8_t instance_index, uint8_t user_id)
{
}
Expand Down

0 comments on commit 7f08cdf

Please sign in to comment.