Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2040541yba; Tue, 2 Apr 2019 23:24:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqyB9UuamQLiBm8/nbJDfeo4av/0v29UbaQC6oXuM+MXLHFhhut99fntOEvsBktqpOeM3TSD X-Received: by 2002:a17:902:f24:: with SMTP id 33mr71869465ply.47.1554272666485; Tue, 02 Apr 2019 23:24:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554272666; cv=none; d=google.com; s=arc-20160816; b=wqtMJwQjHPHJGMmWDBuYjDO6c6ZA05x3tJV6XHphgMt29z1LxSSLGmM8u/uMUEhLWa sRzU+fGOQO/E49qC0ybfpGkJs7SD4MLdPyHlu4lXA03jUvNhM6MGjDnNDtIP7Ra43TzD 5RWIAiOx3jgvr9A/wOeR2ID0SS3a9C8k5hAZLero+Na7IDiJzFTwZbSCL7JM5a95lpt9 ysd9ZCOCAHR3hYTa1jX5L1GvMnXsuDl8Y5TTQlXQanLqaM28mdUvCMpfamE1PaYusYhn OBJhd1SMOkRLmmeBh/CTGdfbdkpD3PeM5yM6o3Sh8uXkpCnA7owVZG02lPZfd0a21H3k BJkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature:dkim-signature; bh=xCtpoRn1R1anWXU5cX9axMToke0YoxN6IBLuZN5Bko0=; b=ZC53tps6Eds255kPwPHKJ7qnilG5Vm8TOxO3f7uR4Xru9dgx6H6333gAKZPVVDNMGe bHHaHzF7zQESgvWiMkSY8Qvb0y3rWCiCerKRynwrLDAYCTDB1NopARYcqWjZwNXxEWeM 564TGWPc+bhfWpfDZBlH3z0HSzdizDPI77EE+xqF1pwFJaQ0S89ptN7g4oRkaYGS6HVY djMQsMwBNt1eELcaPspxPDMHqueiWlmZP+W5AcpP8kTzlMiweM5q+ueLIgfhCrYcXeNW NJV73HqyA3xafSfCC854RQ1dVqsatzT739Yk9JfMO7CglEGmF5OmitgKSlbBP1nbQ6Jv 8Zfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=JgIOBVnO; dkim=pass header.i=@codeaurora.org header.s=default header.b=OMBSM89Q; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o12si12750982pgp.94.2019.04.02.23.24.09; Tue, 02 Apr 2019 23:24:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=JgIOBVnO; dkim=pass header.i=@codeaurora.org header.s=default header.b=OMBSM89Q; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727346AbfDCGX3 (ORCPT + 99 others); Wed, 3 Apr 2019 02:23:29 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:47976 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725879AbfDCGX2 (ORCPT ); Wed, 3 Apr 2019 02:23:28 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 3FD8D609EF; Wed, 3 Apr 2019 06:23:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1554272607; bh=6AQngCmrRNLvLhHqstHqh7bOMbauH/DZ91cJ4U/0UyU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=JgIOBVnO82ydWNm/pU9HsQR2YcBjHP7aadxfYXHICCjQE5Bm+yorMcrxx0MRlejuF gMEVYB6QLDdunY8kHP14n0a0WdPvEuphiPxz0PyK8xvTrI7Bb8cVbqobfMtDwzyXz9 unvTkxNfz0f8wDybNERzodnWmuVyQRIFOfe9VtTw= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id 4CB6F60721; Wed, 3 Apr 2019 06:23:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1554272606; bh=6AQngCmrRNLvLhHqstHqh7bOMbauH/DZ91cJ4U/0UyU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=OMBSM89QlLQ9Wz6nQkf0D5Sn7pzFVe7vC4sgNATS/GlrDiFdLSZzkzOnI8a4BbuiP fudvJ2Xa/pnlAN9QYSSuQeeU1+IHVybHd7VdT/d5IFKcjUudPQQDo+H2kSTQQcDStM t/hdt4zNq/3004Eenq1zriqVOP8yaVQ1/1cLXEKA= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 03 Apr 2019 11:53:26 +0530 From: Balakrishna Godavarthi To: Matthias Kaehlcke , c-hbandi@codeaurora.org Cc: Marcel Holtmann , Johan Hedberg , linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org, Hemantg Subject: Re: [PATCH 2/2] Bluetooth: hci_qca: wcn3990: Drop baudrate change vendor event In-Reply-To: <20190402180501.GK112750@google.com> References: <20190307004041.38059-1-mka@chromium.org> <20190307004041.38059-3-mka@chromium.org> <20190307182009.GB138592@google.com> <20190307233039.GA69116@google.com> <20190401171202.GH112750@google.com> <1bebaf0766988a9f27cbbcb9bb35e26f@codeaurora.org> <20190402180501.GK112750@google.com> Message-ID: <1200f5c32e029c603667d66a4c62a634@codeaurora.org> X-Sender: bgodavar@codeaurora.org User-Agent: Roundcube Webmail/1.2.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org + Harish to update his findings on wcn3998. Mean time i will perform a regression to detect the failure. On 2019-04-02 23:35, Matthias Kaehlcke wrote: > On Tue, Apr 02, 2019 at 05:32:54PM +0530, Balakrishna Godavarthi wrote: >> Hi Matthias, >> >> On 2019-04-01 22:42, Matthias Kaehlcke wrote: >> > On Mon, Apr 01, 2019 at 01:48:23PM +0530, Balakrishna Godavarthi wrote: >> > > Hi Matthias, >> > > >> > > On 2019-04-01 13:29, Balakrishna Godavarthi wrote: >> > > > Hi Matthias, >> > > > >> > > > Sorry for the late reply i was on vacation. >> > > > >> > > > On 2019-03-08 05:00, Matthias Kaehlcke wrote: >> > > > > On Thu, Mar 07, 2019 at 10:20:09AM -0800, Matthias Kaehlcke wrote: >> > > > > > Hi Balakrishna, >> > > > > > >> > > > > > On Thu, Mar 07, 2019 at 10:35:08AM +0530, Balakrishna Godavarthi >> > > > > > wrote: >> > > > > > > hi Matthias, >> > > > > > > >> > > > > > > On 2019-03-07 06:10, Matthias Kaehlcke wrote: >> > > > > > > > Firmware download to the WCN3990 often fails with a 'TLV response size >> > > > > > > > mismatch' error: >> > > > > > > > >> > > > > > > > [ 133.064659] Bluetooth: hci0: setting up wcn3990 >> > > > > > > > [ 133.489150] Bluetooth: hci0: QCA controller version 0x02140201 >> > > > > > > > [ 133.495245] Bluetooth: hci0: QCA Downloading qca/crbtfw21.tlv >> > > > > > > > [ 133.507214] Bluetooth: hci0: QCA TLV response size mismatch >> > > > > > > > [ 133.513265] Bluetooth: hci0: QCA Failed to download patch (-84) >> > > > > > > > >> > > > > > > > This is caused by a vendor event that corresponds to an earlier command >> > > > > > > > to change the baudrate. The event is not processed in the context of the >> > > > > > > > baudrate change and later interpreted as response to the firmware >> > > > > > > > download command (which is also a vendor command), but the driver >> > > > > > > > detects >> > > > > > > > that the event doesn't have the expected amount of associated data. >> > > > > > > > >> > > > > > > > More details: >> > > > > > > > >> > > > > > > > For the WCN3990 the vendor command for a baudrate change isn't sent as >> > > > > > > > synchronous HCI command, because the controller sends the corresponding >> > > > > > > > vendor event with the new baudrate. The event is received and decoded >> > > > > > > > after the baudrate change of the host port. >> > > > > > > > >> > > > > > > > Identify the 'unused' event when it is received and don't add it to >> > > > > > > > the queue of RX frames. >> > > > > > > > >> > > > > > > > Signed-off-by: Matthias Kaehlcke >> > > > > > > > --- >> > > > > > > >> > > > > > > ... >> > > > > > > >> > > > > > > Can you test by reverting this change "94d6671473924". >> > > > > > >> > > > > > The issue is still reproducible. >> > > > > > >> > > > > > > We need at least 15ms minimum delay for the soc to change its baud rate and >> > > > > > > respond to the with command complete event. >> > > > > > >> > > > > > The baudrate change has clearly been successful when the problem is >> > > > > > observed, since the host receives the vendor event with the new >> > > > > > baudrate. >> > > > > >> > > > > I forgot to mention this earlier: the controller doesn't send a >> > > > > command complete event for the command, or at least not a correct >> > > > > one. >> > > > > >> > > > > That's the data that is received: >> > > > > >> > > > > 04 0e 04 01 00 00 00 >> > > > > ~~ ~~ >> > > > > >> > > > [Bala]: can you share me the command sent and event recevied. >> > > > I see that we receive a command complete event for the baud rate >> > > > change command. >> > > > >> > > > command sent: 01 48 fc 01 11 >> > > > vendor specific event: 04 ff 02 92 01 >> > > > command complete event: 04 0e 04 01 00 00 00. >> > > > >> > > > >> > > > >> > > > > This is *a* command complete event, but the opcode is 0x0000 instead >> > > > > of the earlier command. The same happens for the firmware >> > > > > download/read version command, which is the reason why the command >> > > > > complete injection mess >> > > > > (https://lore.kernel.org/patchwork/patch/1027955/) is needed in one >> > > > > way or another. >> > > > > >> > > > [Bala]: fw download approach is different where we use >> > > > __hci_cmd_sync() where as here we use hci_uart_tx_wakeup() >> > > > which directly calls the hci_uart_write_work(). so even we >> > > > send an valid opcode or not for baudrate change will bot matter. >> > > > >> > > [Bala]: i miss understood the comment. Yes your true. in the all >> > > vendor >> > > commands SoC responds with an 0x0000 opcode. >> > >> > And IIUC this is not compliant with the spec, or at least the BT core >> > expects the actual opcode to consider the command to be completed. >> >> [Bala]: Did you try increasing the the baud rate change timeout to >> 50ms >> instead of 10ms. > > It is even reproducible with the ROME timeout of 300ms. > > The timeout doesn't help here. With 78e8fa2972e5 ("Bluetooth: hci_qca: > Deassert RTS while baudrate change command") RTS is deasserted during > the baudrate change, hence the controller only sends the response when > RTS is asserted again. Before the event resulted in a frame reassembly > error and the data was discarded. > >> i suspect it is an timing issue. > > Timing is certainly also a factor here (the problem isn't seen > always), but I don't think 'timing issue' is a proper description of > this issue. The problem is an event that the Bluetooth core doesn't > expect due to the hack of sending a raw command behind the core's back > to work around the firmware 'feature' of sending the command response > with the new baudrate. > > Maybe a delay after re-asserting RTS can address is reliably, I don't > remember if I already experimented with that in the past. If a delay > can 'fix' the issue reliably I'm open to consider it for the sake of > simplicity, but only with a detailed comment that describes the > problem. -- Regards Balakrishna.