Bluetooth: RFCOMM: Fix BT_RFCOMM_BUF_SIZE to include FCS and len

Profiles uses this helper to allocate net buf, so it should include
2 byte length in RFCOMM header and FCS which will be appended in the
tail by RFCOMM.

Change-Id: I0118eb9b0e0ab1daa9267c165af62bb50f1575d9
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
This commit is contained in:
Jaganath Kanakkassery 2016-08-26 22:55:28 +05:30 committed by Johan Hedberg
commit ca938e0dcd

View file

@ -78,11 +78,15 @@ struct bt_rfcomm_msc {
#define BT_RFCOMM_CHECK_MTU(mtu) (!!((mtu) >= BT_RFCOMM_SIG_MIN_MTU && \
(mtu) <= BT_RFCOMM_SIG_MAX_MTU))
/* Helper to calculate needed outgoing buffer size */
/* Helper to calculate needed outgoing buffer size.
* Length in rfcomm header can be two bytes depending on user data length.
* One byte in the tail should be reserved for FCS.
*/
#define BT_RFCOMM_BUF_SIZE(mtu) (CONFIG_BLUETOOTH_HCI_SEND_RESERVE + \
sizeof(struct bt_hci_acl_hdr) + \
sizeof(struct bt_l2cap_hdr) + \
sizeof(struct bt_rfcomm_hdr) + (mtu))
sizeof(struct bt_rfcomm_hdr) + 1 + (mtu) + \
BT_RFCOMM_FCS_SIZE)
#define BT_RFCOMM_GET_DLCI(addr) (((addr) & 0xfc) >> 2)
#define BT_RFCOMM_GET_FRAME_TYPE(ctrl) ((ctrl) & 0xef)