提交 35d401df 编写于 作者: G Gustavo Padovan 提交者: Johan Hedberg

Bluetooth: Get a more accurate L2CAP PDU len

Both FCS and Extended header might be or might not be present in a ERTM
channel.
Signed-off-by: NGustavo Padovan <gustavo.padovan@collabora.co.uk>
Reviewed-by: NMat Martineau <mathewm@codeaurora.org>
Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
上级 523e93cd
......@@ -2130,7 +2130,13 @@ static int l2cap_segment_sdu(struct l2cap_chan *chan,
pdu_len = min_t(size_t, pdu_len, L2CAP_BREDR_MAX_PAYLOAD);
/* Adjust for largest possible L2CAP overhead. */
pdu_len -= L2CAP_EXT_HDR_SIZE + L2CAP_FCS_SIZE;
if (chan->fcs)
pdu_len -= L2CAP_FCS_SIZE;
if (test_bit(FLAG_EXT_CTRL, &chan->flags))
pdu_len -= L2CAP_EXT_HDR_SIZE;
else
pdu_len -= L2CAP_ENH_HDR_SIZE;
/* Remote device may have requested smaller PDUs */
pdu_len = min_t(size_t, pdu_len, chan->remote_mps);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册