Skip to content
Snippets Groups Projects
Commit be74cf8d authored by Myles Watson's avatar Myles Watson Committed by Gerrit Code Review
Browse files

Merge "gd hci: Handle overflow of acl credits"

parents 78f1aba4 2eb6ce13
No related branches found
No related tags found
No related merge requests found
......@@ -205,14 +205,27 @@ void RoundRobinScheduler::incoming_acl_credits(uint16_t handle, uint16_t credits
LOG_INFO("Dropping %hx received credits to unknown connection 0x%0hx", credits, handle);
return;
}
acl_queue_handler->second.number_of_sent_packets_ -= credits;
if (acl_queue_handler->second.number_of_sent_packets_ >= credits) {
acl_queue_handler->second.number_of_sent_packets_ -= credits;
} else {
LOG_WARN("receive more credits than we sent");
acl_queue_handler->second.number_of_sent_packets_ = 0;
}
if (acl_queue_handler->second.connection_type_ == ConnectionType::CLASSIC) {
acl_packet_credits_ += credits;
if (acl_packet_credits_ > max_acl_packet_credits_) {
acl_packet_credits_ = max_acl_packet_credits_;
LOG_WARN("acl packet credits overflow due to receive %hx credits", credits);
}
} else {
le_acl_packet_credits_ += credits;
if (le_acl_packet_credits_ > le_max_acl_packet_credits_) {
le_acl_packet_credits_ = le_max_acl_packet_credits_;
LOG_WARN("le acl packet credits overflow due to receive %hx credits", credits);
}
}
ASSERT(acl_packet_credits_ <= max_acl_packet_credits_);
ASSERT(le_acl_packet_credits_ <= le_max_acl_packet_credits_);
if (acl_packet_credits_ == credits || le_acl_packet_credits_ == credits) {
start_round_robin();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment