Skip to content

Commit 8b5c84e

Browse files
cvinayakcarlescufi
authored andcommitted
Bluetooth: Controller: Collision resolution to use ticks_slot_window
When resolving collision if ticks_slot_window is set for either of the ticker then skip and such ticker be rescheduled outside the collision within the ticks_slot_window. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
1 parent 06aae61 commit 8b5c84e

File tree

2 files changed

+31
-6
lines changed

2 files changed

+31
-6
lines changed

subsys/bluetooth/controller/ticker/ticker.c

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -807,14 +807,39 @@ static uint8_t ticker_resolve_collision(struct ticker_node *nodes,
807807
(lazy_next - ticker_next->priority) >
808808
(lazy_current - ticker->priority);
809809

810+
/* Can the current ticker with ticks_slot_window be
811+
* scheduled after the colliding ticker?
812+
*/
813+
uint8_t curr_has_ticks_slot_window =
814+
(ticker->ext_data &&
815+
ticker->ext_data->ticks_slot_window &&
816+
((acc_ticks_to_expire +
817+
ticker_next->ticks_slot) <
818+
(ticker->ext_data->ticks_slot_window -
819+
ticker->ticks_slot)));
820+
821+
/* Colliding next ticker does not use ticks_slot_window
822+
* or it does not fit after the current ticker within
823+
* the ticks_slot_window.
824+
*/
825+
uint8_t next_not_ticks_slot_window =
826+
(!ticker_next->ext_data ||
827+
!ticker_next->ext_data->ticks_slot_window ||
828+
((acc_ticks_to_expire +
829+
ticker_next->ext_data->ticks_slot_window -
830+
ticker_next->ticks_slot) <
831+
ticker->ticks_slot));
832+
810833
/* Check if next node is within this reservation slot
811834
* and wins conflict resolution
812835
*/
813-
if (!lazy_next_periodic_skip &&
814-
(next_force ||
815-
next_is_critical ||
816-
(next_has_priority && !current_is_older) ||
817-
(equal_priority && next_is_older))) {
836+
if (curr_has_ticks_slot_window ||
837+
(!lazy_next_periodic_skip &&
838+
(next_force ||
839+
next_is_critical ||
840+
(next_has_priority && !current_is_older) ||
841+
(equal_priority && next_is_older &&
842+
next_not_ticks_slot_window)))) {
818843
/* This node must be skipped - check window */
819844
return 1U;
820845
}

subsys/bluetooth/controller/ticker/ticker.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ struct ticker_ext {
178178
* reservation may be re-scheduled
179179
* to avoid collision
180180
*/
181-
int32_t ticks_drift; /* Applied drift since last expiry */
181+
uint32_t ticks_drift; /* Actual drift since last expiry */
182182
uint8_t reschedule_state; /* State of re-scheduling of the
183183
* node. See defines
184184
* TICKER_RESCHEDULE_STATE_XXX

0 commit comments

Comments
 (0)