Skip to content

Commit a5c3021

Browse files
Vudentzholtmann
authored andcommitted
Bluetooth: L2CAP: Detect if remote is not able to use the whole MPS
If the remote is not able to fully utilize the MPS choosen recalculate the credits based on the actual amount it is sending that way it can still send packets of MTU size without credits dropping to 0. Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
1 parent 96cd8ea commit a5c3021

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

‎net/bluetooth/l2cap_core.c‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6787,6 +6787,16 @@ static int l2cap_le_data_rcv(struct l2cap_chan *chan, struct sk_buff *skb)
67876787
chan->sdu_len = sdu_len;
67886788
chan->sdu_last_frag = skb;
67896789

6790+
/* Detect if remote is not able to use the selected MPS */
6791+
if (skb->len + L2CAP_SDULEN_SIZE < chan->mps) {
6792+
u16 mps_len = skb->len + L2CAP_SDULEN_SIZE;
6793+
6794+
/* Adjust the number of credits */
6795+
BT_DBG("chan->mps %u -> %u", chan->mps, mps_len);
6796+
chan->mps = mps_len;
6797+
l2cap_chan_le_send_credits(chan);
6798+
}
6799+
67906800
return 0;
67916801
}
67926802

0 commit comments

Comments
 (0)