From patchwork Wed Aug 29 08:58:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siva Rebbagondla X-Patchwork-Id: 10579699 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9E98C174C for ; Wed, 29 Aug 2018 08:54:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8B35C287A7 for ; Wed, 29 Aug 2018 08:54:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7D77528EF8; Wed, 29 Aug 2018 08:54:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 15275287A7 for ; Wed, 29 Aug 2018 08:54:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728021AbeH2Mui (ORCPT ); Wed, 29 Aug 2018 08:50:38 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:34862 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727204AbeH2Muh (ORCPT ); Wed, 29 Aug 2018 08:50:37 -0400 Received: by mail-pf1-f193.google.com with SMTP id p12-v6so1982313pfh.2; Wed, 29 Aug 2018 01:54:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=4cn60lKylXs6V0CG2LfSwS9wVaCsb2nVAYQgjiui95s=; b=N1f/nRZKPhQE11EXAQ5lpgiUb0Sx/szAvUGNcyfkAKhAWZ4oRHvqa7Qk7a957kZxhE AQP9zZj+TRDVGQj3Elsg3jcNs4oBU/T2b46oQ2iY9v88z+8ygFpnJ6A2650Mp2t+jJ45 FsAbqNLYYVtK4b8RA38qRyBSZtUeupmuCRl3izVylmEbDW7kFWuakTiS1n3fOTQrOAj7 OGqQcQGfbL7Bz+LsiJwTy/+8G1bE+NW1SlzMYjK91cbpBCp9pWV7L4C2UDpA8fXu3Riw vh5sPpvO4Cd1BjWObA8S8cJM8QtMk2csFqb2diSf32MpzYiPbxdIzrA1rzo8yobOHdjI 89ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=4cn60lKylXs6V0CG2LfSwS9wVaCsb2nVAYQgjiui95s=; b=EXGJZE7gMPtNcazkKxLFI+7iuFp0iOhel3Bg+ONdQxKOnxrcMs/F3c1KRX7baj7y+h TqxkW0F2nHX+M/vB7QJNnLcxL4K8lFUsFp6fFWg7uwOvCV7XdaOT+ogniSJ0HZW7ns52 96OI1zv62oqYlqBShRIVObXDXNlqfr5JD3TpbzYNkPkWR/aNfIcgAA2MPJ5MMT9n9SyP Y9M+Q6U5tyyy816MV58Wl9+DozBadoNL/eyV0fUbGPLdp9zdA507WXSFhRbRxpL6pfFf 4XF2Abz6v99uVk9MZE2zpdqYbmE9fBWn+DdQLmy0BfMMDpGelo78pnxECDQpxltFXktd EGfA== X-Gm-Message-State: APzg51BAqtsluftalg1U79U0zZrPg3h6HxtD/M/apFJx1MWldfMy+mEk brgZBOL4jHCdoagzlRbyiDI= X-Google-Smtp-Source: ANB0VdaNjQUD27w2Xtv2YmbAArM7/Fwg4W/2TueLAFtuQEOBtENOW3cfumCXslOhcUdpl5tf0YfJvw== X-Received: by 2002:a62:4704:: with SMTP id u4-v6mr5116506pfa.76.1535532884541; Wed, 29 Aug 2018 01:54:44 -0700 (PDT) Received: from cpu459.localdomain ([203.196.161.90]) by smtp.gmail.com with ESMTPSA id h69-v6sm6838154pfh.13.2018.08.29.01.54.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 29 Aug 2018 01:54:44 -0700 (PDT) From: Siva Rebbagondla To: Marcel Holtmann , Johan Hedberg Cc: linux-bluetooth@vger.kernel.org, linux-wireless@vger.kernel.org, Sasidhar Mudigonda , Siva Rebbagondla , Sanjay Kumar Konduri Subject: [PATCH] Bluetooth: btrsi: fix bt tx timeout issue Date: Wed, 29 Aug 2018 14:28:31 +0530 Message-Id: <1535533111-18301-1-git-send-email-siva8118@gmail.com> X-Mailer: git-send-email 2.5.5 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Sanjay Kumar Konduri 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 Signed-off-by: Siva Rebbagondla --- drivers/bluetooth/btrsi.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/bluetooth/btrsi.c b/drivers/bluetooth/btrsi.c index 60d1419..3951f7b 100644 --- a/drivers/bluetooth/btrsi.c +++ b/drivers/bluetooth/btrsi.c @@ -21,8 +21,9 @@ #include #include -#define RSI_HEADROOM_FOR_BT_HAL 16 +#define RSI_DMA_ALIGN 8 #define RSI_FRAME_DESC_SIZE 16 +#define RSI_HEADROOM_FOR_BT_HAL (RSI_FRAME_DESC_SIZE + RSI_DMA_ALIGN) struct rsi_hci_adapter { void *priv; @@ -70,6 +71,16 @@ 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_DMA_ALIGN)) { + u8 *skb_data = skb->data; + int skb_len = skb->len; + + skb_push(skb, RSI_DMA_ALIGN); + skb_pull(skb, PTR_ALIGN(skb->data, + RSI_DMA_ALIGN) - skb->data); + memmove(skb->data, skb_data, skb_len); + skb_trim(skb, skb_len); + } } return h_adapter->proto_ops->coex_send_pkt(h_adapter->priv, skb,