Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions nimble/host/src/ble_hs_hci.c
Original file line number Diff line number Diff line change
Expand Up @@ -560,8 +560,17 @@ ble_hs_hci_acl_tx_now(struct ble_hs_conn *conn, struct os_mbuf **om)
BLE_HS_LOG(DEBUG, "\n");
#endif

/* Account for the controller buf that will hold the txed fragment.
* Do this before ble_hs_tx_data() to avoid a race with the Number of
* Completed Packets event that may arrive before tx returns.
*/
conn->bhc_outstanding_pkts++;
ble_hs_hci_avail_pkts--;

rc = ble_hs_tx_data(frag);
if (rc != 0) {
conn->bhc_outstanding_pkts--;
ble_hs_hci_avail_pkts++;
goto err;
}

Expand All @@ -570,10 +579,6 @@ ble_hs_hci_acl_tx_now(struct ble_hs_conn *conn, struct os_mbuf **om)
*/
conn->bhc_flags |= BLE_HS_CONN_F_TX_FRAG;
pb = BLE_HCI_PB_MIDDLE;

/* Account for the controller buf that will hold the txed fragment. */
conn->bhc_outstanding_pkts++;
ble_hs_hci_avail_pkts--;
}

if (txom != NULL) {
Expand Down
Loading