mirror of
https://github.com/espressif/esp-idf.git
synced 2025-10-03 18:40:59 +02:00
fix(bt/bluedroid): adjust L2CAP round robin msg send strategy
(cherry picked from commit 2ccae5330e
)
Co-authored-by: xuzhekai <xuzhekai@espressif.com>
This commit is contained in:
@@ -1077,7 +1077,7 @@ void l2c_link_check_send_pkts (tL2C_LCB *p_lcb, tL2C_CCB *p_ccb, BT_HDR *p_buf)
|
|||||||
L2CAP_TRACE_ERROR("l2cab is_cong_cback_context");
|
L2CAP_TRACE_ERROR("l2cab is_cong_cback_context");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
list_node_t* start_p_node = NULL;
|
||||||
/* If we are in a scenario where there are not enough buffers for each link to
|
/* If we are in a scenario where there are not enough buffers for each link to
|
||||||
** have at least 1, then do a round-robin for all the LCBs
|
** have at least 1, then do a round-robin for all the LCBs
|
||||||
*/
|
*/
|
||||||
@@ -1092,16 +1092,18 @@ void l2c_link_check_send_pkts (tL2C_LCB *p_lcb, tL2C_CCB *p_ccb, BT_HDR *p_buf)
|
|||||||
p_lcb_cur = list_node(p_node);
|
p_lcb_cur = list_node(p_node);
|
||||||
if (p_lcb_cur == p_lcb) {
|
if (p_lcb_cur == p_lcb) {
|
||||||
p_node = list_next(p_node);
|
p_node = list_next(p_node);
|
||||||
if (p_node) {
|
start_p_node = p_node;
|
||||||
p_lcb = list_node(p_node);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Loop through, starting at the next */
|
/* Loop through, starting at the next */
|
||||||
for ( ; p_node; p_node = list_next(p_node)) {
|
do {
|
||||||
|
/* Check for wraparound */
|
||||||
|
if (p_node == list_end(l2cb.p_lcb_pool)) {
|
||||||
|
p_node = list_begin(l2cb.p_lcb_pool);
|
||||||
|
}
|
||||||
p_lcb = list_node(p_node);
|
p_lcb = list_node(p_node);
|
||||||
#if (BLE_INCLUDED == TRUE)
|
#if (BLE_INCLUDED == TRUE)
|
||||||
L2CAP_TRACE_DEBUG("window = %d,robin_unacked = %d,robin_quota=%d",l2cb.controller_le_xmit_window,l2cb.ble_round_robin_unacked,l2cb.ble_round_robin_quota);
|
L2CAP_TRACE_DEBUG("window = %d,robin_unacked = %d,robin_quota=%d",l2cb.controller_le_xmit_window,l2cb.ble_round_robin_unacked,l2cb.ble_round_robin_quota);
|
||||||
@@ -1118,20 +1120,22 @@ void l2c_link_check_send_pkts (tL2C_LCB *p_lcb, tL2C_CCB *p_ccb, BT_HDR *p_buf)
|
|||||||
#else
|
#else
|
||||||
))
|
))
|
||||||
#endif ///BLE_INCLUDED == TRUE
|
#endif ///BLE_INCLUDED == TRUE
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/* Check for wraparound */
|
/* Check for wraparound */
|
||||||
if (p_node == list_end(l2cb.p_lcb_pool)) {
|
if (p_node == list_end(l2cb.p_lcb_pool)) {
|
||||||
p_node = list_begin(l2cb.p_lcb_pool);
|
p_node = list_begin(l2cb.p_lcb_pool);
|
||||||
p_lcb = list_node(p_node);
|
p_lcb = list_node(p_node);
|
||||||
}
|
}
|
||||||
|
|
||||||
L2CAP_TRACE_DEBUG("in_use=%d,segment_being_sent=%d,link_state=%d,link_xmit_quota=%d",p_lcb->in_use,p_lcb->partial_segment_being_sent,p_lcb->link_state,p_lcb->link_xmit_quota);
|
L2CAP_TRACE_DEBUG("in_use=%d,segment_being_sent=%d,link_state=%d,link_xmit_quota=%d",p_lcb->in_use,p_lcb->partial_segment_being_sent,p_lcb->link_state,p_lcb->link_xmit_quota);
|
||||||
if ( (!p_lcb->in_use)
|
if ( (!p_lcb->in_use)
|
||||||
|| (p_lcb->partial_segment_being_sent)
|
|| (p_lcb->partial_segment_being_sent)
|
||||||
|| (p_lcb->link_state != LST_CONNECTED)
|
|| (p_lcb->link_state != LST_CONNECTED)
|
||||||
|| (p_lcb->link_xmit_quota != 0)
|
|| (p_lcb->link_xmit_quota != 0)
|
||||||
|| (L2C_LINK_CHECK_POWER_MODE (p_lcb)) ) {
|
|| (L2C_LINK_CHECK_POWER_MODE (p_lcb)) ) {
|
||||||
|
p_node = list_next(p_node);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1148,7 +1152,8 @@ void l2c_link_check_send_pkts (tL2C_LCB *p_lcb, tL2C_CCB *p_ccb, BT_HDR *p_buf)
|
|||||||
else if ((p_buf = l2cu_get_next_buffer_to_send (p_lcb)) != NULL) {
|
else if ((p_buf = l2cu_get_next_buffer_to_send (p_lcb)) != NULL) {
|
||||||
l2c_link_send_to_lower (p_lcb, p_buf);
|
l2c_link_send_to_lower (p_lcb, p_buf);
|
||||||
}
|
}
|
||||||
}
|
p_node = list_next(p_node);
|
||||||
|
} while (p_node != start_p_node);
|
||||||
|
|
||||||
/* If we finished without using up our quota, no need for a safety check */
|
/* If we finished without using up our quota, no need for a safety check */
|
||||||
if ( (l2cb.controller_xmit_window > 0)
|
if ( (l2cb.controller_xmit_window > 0)
|
||||||
|
Reference in New Issue
Block a user