Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp653272pxb; Thu, 19 Aug 2021 08:09:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxDZgJClo16Z4Gt4BhfnYb8WRSAKsdwlcTqyo8l94mIM8SYfFUjHb3HRCOcmh1JviC1eiIw X-Received: by 2002:aa7:d815:: with SMTP id v21mr16734820edq.262.1629385743056; Thu, 19 Aug 2021 08:09:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629385743; cv=none; d=google.com; s=arc-20160816; b=PQl8ncVdMUVEWFTQHOawxCJW1WlTRMisCpwgFcTersiP6ITVSReQUoS1ScGAE8ungp p+KJVeTP6mm6tL4ryCO+RtNDaC5LJ8t4mGhy4qPGwgG56ww2Ub2cmRjbiQnBq6LlQcGA 06GSaKDcmuFZ829PCOKWkGM4NBYQ2iKw0blP/E6Uk678bYgMzAfi0o77GvI7ZFCTggfc cO9x3Am9nZd1h83RoHt2/47uwXAiiuaLdpCWCaKiF0roIXomogri2DY2KrcrEKATQbGf k+hO01jPUKg/wSwuHH1x5emzw2QeQOSoXBuYkC+ze/dfV2v5fS9CjdsZnloCfXN5yb1a C7oQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version; bh=jDeP94QtP/K7oyPo/OxrxZLoQl4vxWmvhUCGkHHq4V8=; b=mzeGmL26sbUhAskOTfUf3TS2CKPe01kwoPWK3XAOTSc4aQPWf/5dKCuIc4AQC5J+MJ F5VdLlHl0kPeetP36ToEZoWdoZP0Z1SRuuHJoOSo5p14RyINrsCHyjQgSjvHnG8nv1g6 q+v0vLoYbssyA6Czsneb+ksk4dTsbwkm6sr4Q9qNjjqBfq0bXtfYdIZwNWQCRMGv8HEs Ckvu/D+k5ISnk/qVi7AHWV5W9S0xl0xl8y2EyjPQwBlPobdjpPUx7mWK2sgGI5n7htYx S+415h5FKf+q0cLSyvwSdeCO8tBzNqnJWG5Jcbw/q93RXLy0Gmc+dTzS87AdVqWeKSU3 BF/w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i12si3343562edu.543.2021.08.19.08.08.30; Thu, 19 Aug 2021 08:09:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240686AbhHSPDu convert rfc822-to-8bit (ORCPT + 99 others); Thu, 19 Aug 2021 11:03:50 -0400 Received: from coyote.holtmann.net ([212.227.132.17]:44650 "EHLO mail.holtmann.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240652AbhHSPDs (ORCPT ); Thu, 19 Aug 2021 11:03:48 -0400 Received: from smtpclient.apple (p5b3d23f8.dip0.t-ipconnect.de [91.61.35.248]) by mail.holtmann.org (Postfix) with ESMTPSA id 5B6BCCED16; Thu, 19 Aug 2021 17:03:10 +0200 (CEST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Subject: Re: [PATCH] Bluetooth: hci_qca: Set SSR triggered flags when SSR command is sent out From: Marcel Holtmann In-Reply-To: <086f2add931ff541c8a6349767ae2adc@codeaurora.org> Date: Thu, 19 Aug 2021 17:03:09 +0200 Cc: Johan Hedberg , Matthias Kaehlcke , open list , "open list:BLUETOOTH SUBSYSTEM" , Hemantg , MSM , pharish@codeaurora.org, Rocky Liao , hbandi@codeaurora.org, Abhishek Pandit-Subedi , mcchou@chromium.org Content-Transfer-Encoding: 8BIT Message-Id: <6238C7AB-32D7-4D12-A14E-24D12A862405@holtmann.org> References: <1629091302-7893-1-git-send-email-bgodavar@codeaurora.org> <1CE27E9C-EABD-4B25-B255-8925297D11BD@holtmann.org> <086f2add931ff541c8a6349767ae2adc@codeaurora.org> To: Balakrishna Godavarthi X-Mailer: Apple Mail (2.3654.120.0.1.13) Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Balakrishna, >>> This change sets SSR triggered flags when QCA SSR command is sent to >>> SoC. After the SSR command sent, driver discards the incoming data from >>> the upper layers. This way will ensure to read full dumps from the >>> BT SoC without any flow control issues due to excess of data receiving >>> from the HOST in audio usecases. >>> Signed-off-by: Balakrishna Godavarthi >>> --- >>> drivers/bluetooth/hci_qca.c | 10 ++++++++++ >>> 1 file changed, 10 insertions(+) >>> diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c >>> index 53deea2..5cbed6a 100644 >>> --- a/drivers/bluetooth/hci_qca.c >>> +++ b/drivers/bluetooth/hci_qca.c >>> @@ -69,6 +69,8 @@ >>> #define QCA_LAST_SEQUENCE_NUM 0xFFFF >>> #define QCA_CRASHBYTE_PACKET_LEN 1096 >>> #define QCA_MEMDUMP_BYTE 0xFB >>> +#define QCA_SSR_OPCODE 0xFC0C >>> +#define QCA_SSR_PKT_LEN 5 >>> enum qca_flags { >>> QCA_IBS_DISABLED, >>> @@ -871,6 +873,14 @@ static int qca_enqueue(struct hci_uart *hu, struct sk_buff *skb) >>> /* Prepend skb with frame type */ >>> memcpy(skb_push(skb, 1), &hci_skb_pkt_type(skb), 1); >>> + if (hci_skb_pkt_type(skb) == HCI_COMMAND_PKT && >>> + skb->len == QCA_SSR_PKT_LEN && >>> + hci_skb_opcode(skb) == QCA_SSR_OPCODE) { >>> + bt_dev_info(hu->hdev, "Triggering ssr"); >>> + set_bit(QCA_SSR_TRIGGERED, &qca->flags); >>> + set_bit(QCA_MEMDUMP_COLLECTION, &qca->flags); >>> + } >>> + >> can we please stop hacking around by parsing opcodes in an enqueue >> function. Sounds like someone is injecting raw HCI vendor commands and >> then having a driver react to it. > [Bala]: yes this opcode is injected via hcitool to test BT SoC dump procedure or > to collect the dumps to debug the issue during issue cases. When audio usecases are running, > HOST sends ACL packets to SoC, in meantime if this command is sent to SoC using hcitool > to collect dumps at particular point, With out this check HOST is pumping continues data to > SoC and SoC RFR line goes high, sometimes SoC become unresponsive and driver starts logging > command timeout error. Instead here, once a cmd with this opcode is sent, timer is started > to ensure that SSR is in progress. If no response from SoC for 8 seconds. Driver will be restarted. so why would I add a kernel work-around for this? Design a proper interface for this and don’t rely on injecting HCI commands via HCI raw channel. Regards Marcel