nimble/l2cap: Fix hs locking issue when sending le_credit_update

X-Original-Commit: 0b3ea953da71eca84fdcbcfd7affbea2e615ce8e
This commit is contained in:
Łukasz Rymanowski
2017-04-06 10:04:03 +02:00
parent 1294a7f3d7
commit 621e2d9223
3 changed files with 10 additions and 6 deletions
+5 -2
View File
@@ -222,7 +222,7 @@ ble_l2cap_coc_rx_fn(struct ble_l2cap_chan *chan)
* so since we have still buffer to handle it
*/
rx->credits = 1;
ble_l2cap_sig_le_credits(chan, rx->credits);
ble_l2cap_sig_le_credits(chan->conn_handle, chan->scid, rx->credits);
}
BLE_HS_LOG(DEBUG, "Received partial sdu_len=%d, credits left=%d\n",
@@ -468,7 +468,10 @@ ble_l2cap_coc_recv_ready(struct ble_l2cap_chan *chan, struct os_mbuf *sdu_rx)
* to be able to send complete SDU.
*/
if (chan->coc_rx.credits < c->initial_credits) {
ble_l2cap_sig_le_credits(chan, c->initial_credits - chan->coc_rx.credits);
ble_hs_unlock();
ble_l2cap_sig_le_credits(chan->conn_handle, chan->scid,
c->initial_credits - chan->coc_rx.credits);
ble_hs_lock();
chan->coc_rx.credits = c->initial_credits;
}
+3 -3
View File
@@ -1047,7 +1047,7 @@ ble_l2cap_sig_le_credits_rx(uint16_t conn_handle, struct ble_l2cap_sig_hdr *hdr,
}
int
ble_l2cap_sig_le_credits(struct ble_l2cap_chan *chan, uint16_t credits)
ble_l2cap_sig_le_credits(uint16_t conn_handle, uint16_t scid, uint16_t credits)
{
struct ble_l2cap_sig_le_credits *cmd;
struct os_mbuf *txom;
@@ -1059,10 +1059,10 @@ ble_l2cap_sig_le_credits(struct ble_l2cap_chan *chan, uint16_t credits)
return BLE_HS_ENOMEM;
}
cmd->scid = htole16(chan->scid);
cmd->scid = htole16(scid);
cmd->credits = htole16(credits);
return ble_l2cap_sig_tx(chan->conn_handle, txom);
return ble_l2cap_sig_tx(conn_handle, txom);
}
#endif
+2 -1
View File
@@ -108,7 +108,8 @@ int ble_l2cap_sig_coc_connect(uint16_t conn_handle, uint16_t psm, uint16_t mtu,
struct os_mbuf *sdu_rx,
ble_l2cap_event_fn *cb, void *cb_arg);
int ble_l2cap_sig_disconnect(struct ble_l2cap_chan *chan);
int ble_l2cap_sig_le_credits(struct ble_l2cap_chan *chan, uint16_t credits);
int ble_l2cap_sig_le_credits(uint16_t conn_handle, uint16_t scid,
uint16_t credits);
#else
#define ble_l2cap_sig_coc_connect(conn_handle, psm, mtu, sdu_rx, cb, cb_arg) \
BLE_HS_ENOTSUP