Bluetooth: L2CAP: Fix TX queueing for LE CoC

This fixes an issue found on automated testing. If IUT had no credits
to send data, the TX request was not queued, because -EAGAIN error was
not returned to bt_l2cap_chan_send (which was responsible for queueing).

Scenario:
1. IUT was out of credits
2. Tester requested to send some data
3. Credits was given
4. No data was sent

Fixes: ZEP-1896

Change-Id: Ie9d0945d1e6b628cd978ede8105b37b838a61f1a
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
This commit is contained in:
Mariusz Skamra 2017-03-17 17:06:58 +01:00 committed by Johan Hedberg
commit aa435c951f

View file

@ -1104,16 +1104,16 @@ static int l2cap_chan_le_send_sdu(struct bt_l2cap_le_chan *ch,
if (!sent) {
/* Add SDU length for the first segment */
sent = l2cap_chan_le_send(ch, frag, BT_L2CAP_SDU_HDR_LEN);
if (sent < 0) {
if (sent == -EAGAIN) {
sent = 0;
ret = l2cap_chan_le_send(ch, frag, BT_L2CAP_SDU_HDR_LEN);
if (ret < 0) {
if (ret == -EAGAIN) {
/* Store sent data into user_data */
memcpy(net_buf_user_data(buf), &sent,
sizeof(sent));
}
return sent;
return ret;
}
sent = ret;
}
/* Send remaining segments */