From fc60bda779673ad1cd0d8e5b0bb956fdbedfc413 Mon Sep 17 00:00:00 2001 From: Peter Krystad Date: Tue, 24 Jan 2012 12:42:43 -0800 Subject: [PATCH] Bluetooth: Allow headroom in ACL data packets from HCI socket Need to allocate headroom in ACL data packets destined for the Qualcomm PAL that are be transmitted via an HCI socket. The Qualcomm PAL uses extra headroom in skbs to be transmitted to save a copy when passing to the WLAN driver. This headroom is allocated by L2CAP. This same headroom must be added for skbs to be transmitted directly by HCI socket layer. HCI sockets are used to transmit data during Bluetooth qualification testing. CRs-fixed: 332866 Change-Id: I173a16c6cb3882bf4155be051e3b3375ea240369 Signed-off-by: Peter Krystad --- net/bluetooth/hci_sock.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c index 92d72b7fc13..0719874ff91 100644 --- a/net/bluetooth/hci_sock.c +++ b/net/bluetooth/hci_sock.c @@ -523,6 +523,7 @@ static int hci_sock_sendmsg(struct kiocb *iocb, struct socket *sock, struct sock *sk = sock->sk; struct hci_dev *hdev; struct sk_buff *skb; + int reserve = 0; int err; BT_DBG("sock %p sk %p", sock, sk); @@ -560,10 +561,18 @@ static int hci_sock_sendmsg(struct kiocb *iocb, struct socket *sock, goto done; } - skb = bt_skb_send_alloc(sk, len, msg->msg_flags & MSG_DONTWAIT, &err); + /* Allocate extra headroom for Qualcomm PAL */ + if (hdev->dev_type == HCI_AMP && hdev->manufacturer == 0x001d) + reserve = BT_SKB_RESERVE_80211; + + skb = bt_skb_send_alloc(sk, len + reserve, + msg->msg_flags & MSG_DONTWAIT, &err); if (!skb) goto done; + if (reserve) + skb_reserve(skb, reserve); + if (memcpy_fromiovec(skb_put(skb, len), msg->msg_iov, len)) { err = -EFAULT; goto drop;