diff options
author | Gustavo Padovan <gustavo.padovan@collabora.co.uk> | 2012-05-25 17:57:05 -0400 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2012-06-04 23:34:09 -0400 |
commit | 35d401df3db4cb7a0403b42641bbf5694e64d374 (patch) | |
tree | 0a036d2915c8cc27aa5000259c2109a8730a8cd9 | |
parent | 523e93cdb39086b25af2ed19d2a69248510727a2 (diff) |
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: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Reviewed-by: Mat Martineau <mathewm@codeaurora.org>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
-rw-r--r-- | net/bluetooth/l2cap_core.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index 6eb2ef2de723..155aa509b3af 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c | |||
@@ -2130,7 +2130,13 @@ static int l2cap_segment_sdu(struct l2cap_chan *chan, | |||
2130 | pdu_len = min_t(size_t, pdu_len, L2CAP_BREDR_MAX_PAYLOAD); | 2130 | pdu_len = min_t(size_t, pdu_len, L2CAP_BREDR_MAX_PAYLOAD); |
2131 | 2131 | ||
2132 | /* Adjust for largest possible L2CAP overhead. */ | 2132 | /* Adjust for largest possible L2CAP overhead. */ |
2133 | pdu_len -= L2CAP_EXT_HDR_SIZE + L2CAP_FCS_SIZE; | 2133 | if (chan->fcs) |
2134 | pdu_len -= L2CAP_FCS_SIZE; | ||
2135 | |||
2136 | if (test_bit(FLAG_EXT_CTRL, &chan->flags)) | ||
2137 | pdu_len -= L2CAP_EXT_HDR_SIZE; | ||
2138 | else | ||
2139 | pdu_len -= L2CAP_ENH_HDR_SIZE; | ||
2134 | 2140 | ||
2135 | /* Remote device may have requested smaller PDUs */ | 2141 | /* Remote device may have requested smaller PDUs */ |
2136 | pdu_len = min_t(size_t, pdu_len, chan->remote_mps); | 2142 | pdu_len = min_t(size_t, pdu_len, chan->remote_mps); |