Bluetooth: L2CAP: Allocate buffer from channel if supported

Some channels may required specific user data (e.g. IPSP) so even if
data is not segmented use alloc_buf callback to allocate a buffer if
supported.

Change-Id: Iecca4a6979da8bc6745ad5b3b214506d3dd71437
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
Luiz Augusto von Dentz 2015-11-26 13:25:06 +02:00 committed by Anas Nashif
commit 40aaff5779

View file

@ -891,8 +891,8 @@ static void l2cap_chan_le_recv(struct bt_l2cap_chan *chan, struct net_buf *buf)
return;
}
/* Check if SDU needs segmentation */
if (sdu_len > buf->len) {
/* Always allocate buffer from the channel if supported. */
if (chan->ops->alloc_buf) {
chan->_sdu = chan->ops->alloc_buf(chan);
if (!chan->_sdu) {
BT_ERR("Unable to allocate buffer for SDU");