[SRU OEM-B][PATCH 3/3] UBUNTU: SAUCE: Bluetooth:btrsi: fix bt cmd timeout issue

Shrirang Bagul shrirang.bagul at canonical.com
Tue May 22 10:49:12 UTC 2018


From: Ganapathi Raju <ganapathi.kondraju at redpinesignals.com>

BugLink: http://bugs.launchpad.net/bugs/1772626

Sometimes data is coming with unaligned address from kernel BT stack,
if unaligned address is passed, some data in payload is stripped when
packet is loaded to firmware. Fixed this by moving the data to
aligned address.

Signed-off-by: Ganapathi Raju <ganapathi.kondraju at redpinesignals.com>
Signed-off-by: Shrirang Bagul <shrirang.bagul at canonical.com>
---
 drivers/bluetooth/btrsi.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/bluetooth/btrsi.c b/drivers/bluetooth/btrsi.c
index 5dfb2f462f42..3ef62b906576 100644
--- a/drivers/bluetooth/btrsi.c
+++ b/drivers/bluetooth/btrsi.c
@@ -22,8 +22,9 @@
 #include <net/rsi_91x.h>
 #include <net/genetlink.h>
 
-#define RSI_HEADROOM_FOR_BT_HAL	16
+#define RSI_SDIO_DMA_ALIGN	8
 #define RSI_FRAME_DESC_SIZE	16
+#define RSI_HEADROOM_FOR_BT_HAL	(RSI_FRAME_DESC_SIZE + RSI_SDIO_DMA_ALIGN)
 
 struct rsi_hci_adapter {
 	void *priv;
@@ -74,6 +75,15 @@ static int rsi_hci_send_pkt(struct hci_dev *hdev, struct sk_buff *skb)
 		bt_cb(new_skb)->pkt_type = hci_skb_pkt_type(skb);
 		kfree_skb(skb);
 		skb = new_skb;
+		if (!IS_ALIGNED((unsigned long)skb->data, RSI_SDIO_DMA_ALIGN)) {
+			u8 *skb_data = skb->data;
+			int skb_len = skb->len;
+
+			skb_push(skb, RSI_SDIO_DMA_ALIGN);
+			skb_pull(skb, PTR_ALIGN(skb->data,
+				RSI_SDIO_DMA_ALIGN) - skb->data);
+			memmove(skb->data, skb_data, skb_len);
+		}
 	}
 
 	return h_adapter->proto_ops->coex_send_pkt(h_adapter->priv, skb,
-- 
2.17.0





More information about the kernel-team mailing list