Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Bluetooth: btrsi: fix bt tx timeout issue

observed 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 loading to firmware and this results, BT
connection timeout is happening.

sh# hciconfig hci0 up
Can't init device hci0: hci0 command 0x0c03 tx timeout

Fixed this by moving the data to aligned address.

Signed-off-by: Sanjay Kumar Konduri <sanjay.konduri@redpinesignals.com>
Signed-off-by: Siva Rebbagondla <siva.rebbagondla@redpinesignals.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>

authored by

Sanjay Kumar Konduri and committed by
Marcel Holtmann
7cbfd1e2 a5c3021b

+12 -1
+12 -1
drivers/bluetooth/btrsi.c
··· 21 21 #include <net/rsi_91x.h> 22 22 #include <net/genetlink.h> 23 23 24 - #define RSI_HEADROOM_FOR_BT_HAL 16 24 + #define RSI_DMA_ALIGN 8 25 25 #define RSI_FRAME_DESC_SIZE 16 26 + #define RSI_HEADROOM_FOR_BT_HAL (RSI_FRAME_DESC_SIZE + RSI_DMA_ALIGN) 26 27 27 28 struct rsi_hci_adapter { 28 29 void *priv; ··· 71 70 bt_cb(new_skb)->pkt_type = hci_skb_pkt_type(skb); 72 71 kfree_skb(skb); 73 72 skb = new_skb; 73 + if (!IS_ALIGNED((unsigned long)skb->data, RSI_DMA_ALIGN)) { 74 + u8 *skb_data = skb->data; 75 + int skb_len = skb->len; 76 + 77 + skb_push(skb, RSI_DMA_ALIGN); 78 + skb_pull(skb, PTR_ALIGN(skb->data, 79 + RSI_DMA_ALIGN) - skb->data); 80 + memmove(skb->data, skb_data, skb_len); 81 + skb_trim(skb, skb_len); 82 + } 74 83 } 75 84 76 85 return h_adapter->proto_ops->coex_send_pkt(h_adapter->priv, skb,