-
Notifications
You must be signed in to change notification settings - Fork 6.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bluetooth: Delay advertising events instead of dropping them on collision #20264
Comments
I am looking into a ticker update design which would implement this.
This design enables "intelligent" scheduling with only a small processing overhead, and with a simple interface change. |
@mtpr-ot, why reschedule to the latest possible time? Shouldn't it be the earliest possible time? I don't think we want most rescheduled advs to end up at precisely the max possible time - that would completely eliminate their randomization. |
Yes, you're right that we have to be careful not to lose the randomization. However, we want to prevent aborting slave intra-event packets by scheduling early. Some compromise is needed I guess. |
Is your enhancement proposal related to a problem? Please describe.
Currently, an advertising event is dropped when it collides in time with a higher priority event, unless a sufficient number of consecutive advertising events have already been dropped, in which case the advertising event wins, and the higher priority event is dropped. Such collisions can be quite frequent when advertising is running in parallel with multiple connections, especially when some of those connections are carrying audio in large packets. When many advertising events are dropped, it may impair the ability of other devices to detect and connect to the advertiser, and the user may experience this as undesirable latencies and sluggishness.
Describe the solution you'd like
Instead of dropping the advertising event when there's a collision, the event should be rescheduled to the first free time slot in the future. To keep things simple, a time slot should only be considered free if it is large enough to hold the advertising event without overlapping any other events, i.e. priorities/aging should not be considered even if this would allow the advertising event to win over another event in an earlier time slot.
The total time between advertising events should probably be restricted to T_advEvent = advInterval + advDelay as specified in the Core spec v5.1 vol 6 part B section 4.4.2.2.1, where advDelay is a random value in the range 0 - 10 ms. So, if the first free slot corresponds to an advDelay larger than 10 ms, the event should probably be dropped. In order to stay within this limit when rescheduling (which may happen multiple times for the same event), the scheduler would need to store the actual time limit for the given event, until the event is either successfully executed or dropped.
This solution should significantly reduce the number of dropped advertising events as well as the number of other events dropped due to the aging of advertising events, thus increasing the responsiveness of the overall system. The randomization of advDelay would no longer have a flat distribution - large values would have a slightly higher probability than small values - but this is probably a small price to pay.
Describe alternatives you've considered
As mentioned, the spec sets an upper limit of 10 ms on advDelay, so the proposal is to drop the event rather than exceed this limit. However, dropping the event is also in a way equivalent to exceeding the limit (by a much larger amount), so would it actually be better to just ignore the limit? A downside of doing so, is that there would be no theoretical upper bound on how far into the future to search for a free time slot.
Instead of always delaying the advertising event to avoid a collision, one could consider allowing it to be advanced in time as well. This would reduce the risk of dropping events that are already close to the advDelay limit. However, I'm told that collision detection currently happens quite late, so it is not possible to advance the time. Also, if advancing were to occur frequently, it might cause a noticeable increase in average power, which would violate the spec.
Additional context
None.
The text was updated successfully, but these errors were encountered: