From patchwork Sun Jul 5 19:51:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasily Khoruzhick X-Patchwork-Id: 11644629 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7522D60D for ; Sun, 5 Jul 2020 19:53:21 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4D96420739 for ; Sun, 5 Jul 2020 19:53:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="RLWQnv0S"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="rDPbtc8v" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4D96420739 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=gKoQJkhU/9IYOLAEt5hPujlVQJumL4QV9RH9go7t+74=; b=RLWQnv0S1Fftzsq/Q1OBEJFRA OgV4vC4A7adSp6HRLWczLdOjzV9rEzs0DOxnf4EXUf8gjMXpTwtgd+Z31s0M2He0Z0ItglRDMsqXt SGzOP+Nm6KXFcQpNb75ZhUT5sIQU8lxOUWs9HJNRyTkxomgISr0FTjZa6iiUYjzogYChIOTFfskTz D5fW69T3ZKwp2lVS/nYuu2OpwrQGOR8o2+K4Y59Lr3CYYu8QeEgEweHj8aBzJJ74K0v++hOK3/c05 PLUJcheyzZSWAT24MHRtwhrXSwAPk6BK2u8G/fnUjzNYA9HmxOwzitEYVVYu/fyDrXTjUtciCJuB9 fjPcgDx9w==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jsAfs-0007ni-FT; Sun, 05 Jul 2020 19:51:40 +0000 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jsAfm-0007ln-JX for linux-arm-kernel@lists.infradead.org; Sun, 05 Jul 2020 19:51:35 +0000 Received: by mail-pg1-x541.google.com with SMTP id t6so17428462pgq.1 for ; Sun, 05 Jul 2020 12:51:32 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=7RJ6rE3+V5FkJZxVb3v+pVHBk2ZYQcboCzbdh+i0x+E=; b=rDPbtc8vdEMGwEPSHOV5kjTzILxUmRSxurBdo2x2VNrnCmNg2CA4bK0En8Ox5voIVu jflBYMA4ESDAWl5Z5xfAI1Z0QOsgQFDF+9EILJPiVkk7sbSYqF+PGpppNvj28yCpvV1e J3uX+qBHX8q98F9wSaUQxa1WzQBoq7FP2jsovR3BMmfkY+GRu6HXMA0LRHtTJuZ1/KPr ROQRuXbp4XcX2Cuj7m5cpn9QaxXC/kdiSpQdHsNsHVDwtHf009y0ToxFBFQ+AGfulJJ/ QWwblLBZYGdcv/RLUYKFXpvuuTg0YzYH0IAVca3Wb435JlEfrsATbmwoSu+6K0pgbVVU jATg== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=7RJ6rE3+V5FkJZxVb3v+pVHBk2ZYQcboCzbdh+i0x+E=; b=p9R44oANonZGxvJvqnGbxtr1UzJ8aLknKC5UE4w0FZ+sfjMFDsd3J29WvN1B3SDirb j4yelIJxoV90HZeZMDBFDEN1eIoa6bi3WTeR2OrhpcLXwASH0Re0ls4T4KLJM5uU1GsM uYjWDijTSAGnsxcc/z9Ll/5cSi4aHJbm0ZmovHMoR0+DcWi6AefWNEQR9gNtUEbdSdwJ uBL4NN22znLg3s978zgeiaq17zBGZJmMAkXrPqGOJ7Tes11B6nj+dsmVr1FV+OU/gVvt hF781UNGUwAdLCHZWaM/CXUjA1h1rhAoqujQ974E1N1jpEBeskIDh8eg+0Ozcqnn7sSs hatA== X-Gm-Message-State: AOAM531d1I/yc3nDkym/ia34ibXvkDp0wJz7M7+9YCXijAvmmye+fv17 XP0OrermMIVMxdjqxrJz6KY= X-Google-Smtp-Source: ABdhPJyx/0NFcW6FSUxmSN3DKYwTjkoKbr6mmBjMln0ATSOvaHAugjHxaxi03vs9u8Jiv8C8NEH4gQ== X-Received: by 2002:a63:4b04:: with SMTP id y4mr37299434pga.158.1593978690666; Sun, 05 Jul 2020 12:51:30 -0700 (PDT) Received: from anarsoul-thinkpad.lan (216-71-213-236.dyn.novuscom.net. [216.71.213.236]) by smtp.gmail.com with ESMTPSA id g9sm16072879pfm.151.2020.07.05.12.51.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jul 2020 12:51:30 -0700 (PDT) From: Vasily Khoruzhick To: Rob Herring , Maxime Ripard , Chen-Yu Tsai , Marcel Holtmann , Johan Hedberg , "David S. Miller" , Jakub Kicinski , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-bluetooth@vger.kernel.org, netdev@vger.kernel.org, Ondrej Jirman Subject: [PATCH 1/3] Bluetooth: Add new quirk for broken local ext features max_page Date: Sun, 5 Jul 2020 12:51:08 -0700 Message-Id: <20200705195110.405139-2-anarsoul@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200705195110.405139-1-anarsoul@gmail.com> References: <20200705195110.405139-1-anarsoul@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200705_155134_716191_474EB398 X-CRM114-Status: GOOD ( 14.38 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:541 listed in] [list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [anarsoul[at]gmail.com] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vasily Khoruzhick Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Some adapters (e.g. RTL8723CS) advertise that they have more than 2 pages for local ext features, but they don't support any features declared in these pages. RTL8723CS reports max_page = 2 and declares support for sync train and secure connection, but it responds with either garbage or with error in status on corresponding commands. Signed-off-by: Vasily Khoruzhick --- include/net/bluetooth/hci.h | 7 +++++++ net/bluetooth/hci_event.c | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 16ab6ce87883..8e4c16210d18 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -227,6 +227,13 @@ enum { * supported. */ HCI_QUIRK_VALID_LE_STATES, + + /* When this quirk is set, max_page for local extended features + * is set to 1, even if controller reports higher number. Some + * controllers (e.g. RTL8723CS) report more pages, but they + * don't actually support features declared there. + */ + HCI_QUIRK_BROKEN_LOCAL_EXT_FTR_MAX_PAGE, }; /* HCI device flags */ diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index cfeaee347db3..df3232828978 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -700,7 +700,9 @@ static void hci_cc_read_local_ext_features(struct hci_dev *hdev, if (rp->status) return; - if (hdev->max_page < rp->max_page) + if (!test_bit(HCI_QUIRK_BROKEN_LOCAL_EXT_FTR_MAX_PAGE, + &hdev->quirks) && + hdev->max_page < rp->max_page) hdev->max_page = rp->max_page; if (rp->page < HCI_MAX_PAGES)