提交 245b2765 编写于 作者: L Luiz Augusto von Dentz 提交者: Greg Kroah-Hartman

Bluetooth: L2CAP: Detect if remote is not able to use the whole MPS

[ Upstream commit a5c3021bb62b970713550db3f7fd08aa70665d7e ]

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: NLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
上级 2c894646
......@@ -6819,6 +6819,16 @@ static int l2cap_le_data_rcv(struct l2cap_chan *chan, struct sk_buff *skb)
chan->sdu_len = sdu_len;
chan->sdu_last_frag = skb;
/* Detect if remote is not able to use the selected MPS */
if (skb->len + L2CAP_SDULEN_SIZE < chan->mps) {
u16 mps_len = skb->len + L2CAP_SDULEN_SIZE;
/* Adjust the number of credits */
BT_DBG("chan->mps %u -> %u", chan->mps, mps_len);
chan->mps = mps_len;
l2cap_chan_le_send_credits(chan);
}
return 0;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册