Skip to content
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

nimble/ll: Fix sending HCI Number of Completed Packets event #837

Merged

Conversation

andrzej-kaczmarek
Copy link
Contributor

The calculations for sending this HCI event periodically seem strange,
probably something was mixed up in the past here.

After fix I believe this does what it is supposed to do: every X ticks
we'll just go through all connections and send HCI event no matter if
there is something to send or not.

Also added some with reference to spec section.

Copy link

@wes3 wes3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the current code not work? Seems like it should do what it was intended to do: only poll the list of all connections no more often than the completed packet rate but send an event for the current connection if any packets were completed.

The calculations for sending this HCI event periodically are a bit
mysterious at first glance - let's make them more obvious.
@andrzej-kaczmarek
Copy link
Contributor Author

Ok, so I had to write this step-by-step on a paper in order to find out that it seems to work, but I find it really hard to understand - especially the part that 'rate' is added to 'last time' at the end of function and the fact that BLE_NUM_COMP_PKT_RATE is defined in ticks but in code it is multiplied by OS_TICKS_PER_SEC only add to the mystery :-)

Also I found an issue with my change as well so in new patch version I updated only two things I find most difficult to follow.

@wes3
Copy link

wes3 commented Feb 26, 2018

I certainly agree the original code is very confusing and could be written differently to make it clearer. I would have used a timer for it but wanted to save memory. So all good...

@andrzej-kaczmarek andrzej-kaczmarek merged commit 356528c into apache:master Mar 7, 2018
@andrzej-kaczmarek andrzej-kaczmarek deleted the nimble-numpktcmp-fix branch March 7, 2018 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants