Skip to content

Commit 7cbfd1e

Browse files
Sanjay Kumar Konduriholtmann
authored andcommitted
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>
1 parent a5c3021 commit 7cbfd1e

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

‎drivers/bluetooth/btrsi.c‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@
2121
#include <net/rsi_91x.h>
2222
#include <net/genetlink.h>
2323

24-
#define RSI_HEADROOM_FOR_BT_HAL 16
24+
#define RSI_DMA_ALIGN 8
2525
#define RSI_FRAME_DESC_SIZE 16
26+
#define RSI_HEADROOM_FOR_BT_HAL (RSI_FRAME_DESC_SIZE + RSI_DMA_ALIGN)
2627

2728
struct rsi_hci_adapter {
2829
void *priv;
@@ -70,6 +71,16 @@ static int rsi_hci_send_pkt(struct hci_dev *hdev, struct sk_buff *skb)
7071
bt_cb(new_skb)->pkt_type = hci_skb_pkt_type(skb);
7172
kfree_skb(skb);
7273
skb = new_skb;
74+
if (!IS_ALIGNED((unsigned long)skb->data, RSI_DMA_ALIGN)) {
75+
u8 *skb_data = skb->data;
76+
int skb_len = skb->len;
77+
78+
skb_push(skb, RSI_DMA_ALIGN);
79+
skb_pull(skb, PTR_ALIGN(skb->data,
80+
RSI_DMA_ALIGN) - skb->data);
81+
memmove(skb->data, skb_data, skb_len);
82+
skb_trim(skb, skb_len);
83+
}
7384
}
7485

7586
return h_adapter->proto_ops->coex_send_pkt(h_adapter->priv, skb,

0 commit comments

Comments
 (0)