From patchwork Wed Sep 7 17:09:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Peter X-Patchwork-Id: 12969303 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2ED99C38145 for ; Wed, 7 Sep 2022 17:12:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=FFQ4XWzo+x/ltE/dyk1hqYqdRIK+FQ2RltwAhBEBEuM=; b=Ovsgj+kVaBn+g+ nnI15itcva+yZ1RGFXLwvLoQAIFs/Yy7hls0P8QEA9rMhWMeZiOITTRp2qFG7TknIHjBhGvDyJprB jJKfIetKVlinu/CupUx0YEelE3U0tHejth/loV8rkUDiVC4xHEPLcI03XayxSIxPGOGEzxzunKoSJ 6oHXub+SC+NBhTfQ07cXYMpvaKMUflvXdRSNejOUUn/gvFGuatbnnI5aZHRUE1VEC8eV5c26dmel4 NT9zJ2zVCpJwiR4+wDcNCXEBh4rbg3HBhh+cSVkN74xioW/1AfKJLLylUefr5SGhNK0bp2tZbM/Ez /UlyQB+90SA7uCAWPTgw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVyaK-00863A-Cc; Wed, 07 Sep 2022 17:11:32 +0000 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVyYw-0085Er-ER for linux-arm-kernel@lists.infradead.org; Wed, 07 Sep 2022 17:10:08 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 5D82E320094F; Wed, 7 Sep 2022 13:10:04 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Wed, 07 Sep 2022 13:10:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=svenpeter.dev; h=cc:cc:content-transfer-encoding:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm2; t=1662570603; x= 1662657003; bh=ZOAgVmD4sQnWNvzpbfQISdxHPQGYqTpMmJPA7iGKzEE=; b=u D2IcdeQ4XphtQxXHOB+5QESLDS2to1Dd/9Ov/Dw5JwmyEwdZhaJDCRYAU5irXIHZ JsTdyKutKUM3wRenk4S2UuUbc2LOm01K43lOfwE6/mOB7s2xmPMH3joJxD7UCeNB 1ubJPR5wWgRaCYowIG0E2wN+BJ+xhUIxK6C3MU2gQqT4nur1iTX7dCGcXnvYuPlQ 4ox0lzLJOkZoN3TCz/1ug5mJKjz8NDGT/blvmdUZIfWnJSNd8iQuaf+jjLFneMPf XaNFBDKTL5OOIXYIerMerkOd3DQA4bmSG4W0IBIJXVZNdG+uoaBBNm7+I3DmqNCT CYcoDq7lx14661H39CKWQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1662570603; x=1662657003; bh=ZOAgVmD4sQnWN vzpbfQISdxHPQGYqTpMmJPA7iGKzEE=; b=N71k/Ot7mDlaojCjkXIm2WXRyjtgx uY+TWQqhUrX8or1q/e0N7k+qhnsaHxrT1rTOFj/FNkg5cHoA+JVZcziy/IKPcJo5 aUBzCZF710/kyy0FmWJsBMCjasjySHs6tHPWWtGHRofew72DCkklkyj9FY5F0m0x pnlHAw9ifI0wqx07G1xGyMLu0CahW3/sjWTfchWx0hKSD0kcbYMZLkrskhbGqPuH leTggxcd8dEE1kWObtAFApBRYRiS2X3yHEbTKdcpq7q3sbLyz3MYLCcRTkdJxf7M 6olGsoMIx0cSGZdFNMe7ph+bwsUgHtdBJLFIC7z6k3XTCjfuelJPUepfA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfedttddguddutdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefuvhgv nhcurfgvthgvrhcuoehsvhgvnhesshhvvghnphgvthgvrhdruggvvheqnecuggftrfgrth htvghrnhepjeeiheehkeegvdejhfevkeejgfdutdefhfethedtieffleekieeuudefleek jeegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepsh hvvghnsehsvhgvnhhpvghtvghrrdguvghv X-ME-Proxy: Feedback-ID: i51094778:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 7 Sep 2022 13:10:01 -0400 (EDT) From: Sven Peter To: Marcel Holtmann , Johan Hedberg , Luiz Augusto von Dentz Cc: Sven Peter , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Krzysztof Kozlowski , Paolo Abeni , Rob Herring , Hector Martin , Alyssa Rosenzweig , asahi@lists.linux.dev, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 4/5] Bluetooth: Add quirk to disable extended scanning Date: Wed, 7 Sep 2022 19:09:34 +0200 Message-Id: <20220907170935.11757-5-sven@svenpeter.dev> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20220907170935.11757-1-sven@svenpeter.dev> References: <20220907170935.11757-1-sven@svenpeter.dev> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220907_101006_591153_28B01402 X-CRM114-Status: GOOD ( 15.18 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Broadcom 4377 controllers found in Apple x86 Macs with the T2 chip claim to support extended scanning when querying supported states, < HCI Command: LE Read Supported St.. (0x08|0x001c) plen 0 > HCI Event: Command Complete (0x0e) plen 12 LE Read Supported States (0x08|0x001c) ncmd 1 Status: Success (0x00) States: 0x000003ffffffffff [...] LE Set Extended Scan Parameters (Octet 37 - Bit 5) LE Set Extended Scan Enable (Octet 37 - Bit 6) [...] , but then fail to actually implement the extended scanning: < HCI Command: LE Set Extended Sca.. (0x08|0x0041) plen 8 Own address type: Random (0x01) Filter policy: Accept all advertisement (0x00) PHYs: 0x01 Entry 0: LE 1M Type: Active (0x01) Interval: 11.250 msec (0x0012) Window: 11.250 msec (0x0012) > HCI Event: Command Complete (0x0e) plen 4 LE Set Extended Scan Parameters (0x08|0x0041) ncmd 1 Status: Unknown HCI Command (0x01) Signed-off-by: Sven Peter --- changes from v1: - adjusted the commit message a bit to make checkpatch happy include/net/bluetooth/hci.h | 10 ++++++++++ include/net/bluetooth/hci_core.h | 4 +++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 62539c1a6bf2..05a13b0c5ff1 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -274,6 +274,16 @@ enum { * during the hdev->setup vendor callback. */ HCI_QUIRK_FIXUP_LE_EXT_ADV_REPORT_EVT_TYPE, + + /* + * When this quirk is set, the HCI_OP_LE_SET_EXT_SCAN_ENABLE command is + * disabled. This is required for some Broadcom controllers which + * erroneously claim to support extended scanning. + * + * This quirk can be set before hci_register_dev is called or + * during the hdev->setup vendor callback. + */ + HCI_QUIRK_BROKEN_EXT_SCAN, }; /* HCI device flags */ diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index e7862903187d..29d1254f9856 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -1681,7 +1681,9 @@ void hci_conn_del_sysfs(struct hci_conn *conn); /* Use ext scanning if set ext scan param and ext scan enable is supported */ #define use_ext_scan(dev) (((dev)->commands[37] & 0x20) && \ - ((dev)->commands[37] & 0x40)) + ((dev)->commands[37] & 0x40) && \ + !test_bit(HCI_QUIRK_BROKEN_EXT_SCAN, &(dev)->quirks)) + /* Use ext create connection if command is supported */ #define use_ext_conn(dev) ((dev)->commands[37] & 0x80)