From patchwork Thu Apr 23 14:43:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alain Michaud X-Patchwork-Id: 11505825 X-Patchwork-Delegate: marcel@holtmann.org 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 1A8C4913 for ; Thu, 23 Apr 2020 14:43:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 043552098B for ; Thu, 23 Apr 2020 14:43:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="gwyEd2TG" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728190AbgDWOnk (ORCPT ); Thu, 23 Apr 2020 10:43:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726380AbgDWOnk (ORCPT ); Thu, 23 Apr 2020 10:43:40 -0400 Received: from mail-ua1-x944.google.com (mail-ua1-x944.google.com [IPv6:2607:f8b0:4864:20::944]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2070EC08E934 for ; Thu, 23 Apr 2020 07:43:40 -0700 (PDT) Received: by mail-ua1-x944.google.com with SMTP id 36so1822220uaf.9 for ; Thu, 23 Apr 2020 07:43:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MRgEfFWldJ+nbPjKrWVW/UCyBRIS5F0risTypuqjZbc=; b=gwyEd2TGkygP5ZI9Mw4tjYV5V1JxsI4x1VuWS8xPhOkkyku/DAFlzUqQoLrQCgd52P qvSyXpjMg7vT2II8tQ8xO+1rBw/I2oORPzN/3Q2epEsL8Zg/bILleJl7tuW8cHcStA6z Tdqbu0Hf5kdaYPjDDy4wV/wfnW2OZRej78C74= 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=MRgEfFWldJ+nbPjKrWVW/UCyBRIS5F0risTypuqjZbc=; b=dzLRcHrs8oeI/yg1gYaB4T2VBgnteH3DGNMaD1quMUUMsk/j3iu0Wy0WBlkgpJEysN GHvpDfneEPHW57NRzG4kBYGSOOwe3+qiX9nbRWwcgnKXlLXZzguCGUYtgZtJDwLHmQqx Ck8TAfsxWWsLOyMBc6aH3yP9nN30/iXjkEpy3hJGVRzlo6KLZZBr9chXFMUILgBODpqt 11w+s5Psfg6s2h6pFkwvJpJ1Vxx2vTB+MA6eVsxZebQr1UnKWoWrGKbXx8vhnqugKlVQ 8Hx4cJ+733aVuJtkmestdNXtenZH+PWFJQonR6NabBe20B8Is7ucsh727nHnnlvvl9q1 4niw== X-Gm-Message-State: AGi0PuYdW/XXc+GZmLcgKkItPG8YeHlBvk3sPhcW+rCSvtfFiwTDxIge 46Fbw7YlsXWhRcsIZIYPGmtXL5zvKnw= X-Google-Smtp-Source: APiQypLBtVRBs3350Zidyzog6HLIDcHd1Ww8twCeVhSReJRESu4V1eWu2L5nxPlW/x6F6IWw8NEkuw== X-Received: by 2002:a67:ff8d:: with SMTP id v13mr3484101vsq.71.1587653019057; Thu, 23 Apr 2020 07:43:39 -0700 (PDT) Received: from alain.c.googlers.com.com (161.138.243.35.bc.googleusercontent.com. [35.243.138.161]) by smtp.gmail.com with ESMTPSA id d83sm762107vka.34.2020.04.23.07.43.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2020 07:43:38 -0700 (PDT) From: Alain Michaud To: linux-bluetooth@vger.kernel.org Cc: Alain Michaud Subject: [PATCH v3 1/3] bluetooth:Adding driver and quirk defs for multi-role LE Date: Thu, 23 Apr 2020 14:43:27 +0000 Message-Id: <20200423144328.82478-2-alainm@chromium.org> X-Mailer: git-send-email 2.26.1.301.g55bc3eb7cb9-goog In-Reply-To: <20200423144328.82478-1-alainm@chromium.org> References: <20200423144328.82478-1-alainm@chromium.org> MIME-Version: 1.0 Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org This change adds the relevant driver and quirk to allow drivers to report the le_states as being trustworthy. This has historically been disabled as controllers did not reliably support this. In particular, this will be used to relax this condition for controllers that have been well tested and reliable. /* Most controller will fail if we try to create new connections * while we have an existing one in slave role. */ if (hdev->conn_hash.le_num_slave > 0) return NULL; Signed-off-by: Alain Michaud --- drivers/bluetooth/btusb.c | 2 +- include/net/bluetooth/hci.h | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index 3bdec42c9612..dd27e28d4601 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -58,7 +58,7 @@ static struct usb_driver btusb_driver; #define BTUSB_CW6622 0x100000 #define BTUSB_MEDIATEK 0x200000 #define BTUSB_WIDEBAND_SPEECH 0x400000 - +#define BTUSB_VALID_LE_STATES 0x800000 static const struct usb_device_id btusb_table[] = { /* Generic Bluetooth USB device */ { USB_DEVICE_INFO(0xe0, 0x01, 0x01) }, diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 5f60e135aeb6..25c2e5ee81dc 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -214,6 +214,15 @@ enum { * This quirk must be set before hci_register_dev is called. */ HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED, + + /* When this quirk is set, the controller has validated that + * LE states reported through the HCI_LE_READ_SUPPORTED_STATES are + * valid. This mechanism is necessary as many controllers have + * been seen has having trouble initiating a connectable + * advertisement despite the state combination being reported as + * supported. + */ + HCI_QUIRK_VALID_LE_STATES, }; /* HCI device flags */ From patchwork Thu Apr 23 14:43:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alain Michaud X-Patchwork-Id: 11505827 X-Patchwork-Delegate: marcel@holtmann.org 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 907CF913 for ; Thu, 23 Apr 2020 14:43:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7981420857 for ; Thu, 23 Apr 2020 14:43:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="E4neivPK" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728128AbgDWOnr (ORCPT ); Thu, 23 Apr 2020 10:43:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726380AbgDWOnq (ORCPT ); Thu, 23 Apr 2020 10:43:46 -0400 Received: from mail-ua1-x941.google.com (mail-ua1-x941.google.com [IPv6:2607:f8b0:4864:20::941]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBC98C08E934 for ; Thu, 23 Apr 2020 07:43:46 -0700 (PDT) Received: by mail-ua1-x941.google.com with SMTP id i22so5890563uak.6 for ; Thu, 23 Apr 2020 07:43:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=23PczzMyR6+ew4AVNhl/pFHjr/juWJO8Y8y4apArs1A=; b=E4neivPKiCEMH80abgQ0UVVz6meHkEJVVLyHqsaLLBDzQO/I5HsQ8rhfVwOLtYpWn7 YtXxfZCp+GWeL5jY6eZWqvPPvOTLeCbvEZjj+WPx88eZ1RMn+3JMeGp/0D3RXWWDwNWh K7LYxfCAadBsx9osMUH9Kt9OfPFNaOHbg+JZU= 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=23PczzMyR6+ew4AVNhl/pFHjr/juWJO8Y8y4apArs1A=; b=AgguwVB/oB9of/UD07W8v3q5h8rXpgf6DsFzgCGnhq26vd5q5PjCYBb4+6kbdx86/a avmuVN6dd+PX5G1r6nLt1K3ehOMUgn2NvTuXeJCXBOMFfsFAwXeUszu3uMhXlZAZRb8B yfRXf3c9QiO5qGexiS0VyRF4mdu6n62oG/PNPNRJ45oNK3RqTLq86HKElVm6sXpBmktZ mjWRFeZnbRleZw4isaZeoX4sWRQaWYgp3fMc1EEwpNQOz1EopaQcqsR624/GpavEl0YA 0pf649VSeUXaSlRZ8Fp5Dv92cgTDg0NoQh4d4cSKdp3YLF+IQiDyxLYITAHMYeDKIrnA JEgw== X-Gm-Message-State: AGi0PubgYmuFiWbOvz7KJ2hVHU4O8DP1knQNVufXPXkjiaT5B5jEDrJ8 NwPeH6fmdiu7ipPcBRj2rUcFQQn4YPU= X-Google-Smtp-Source: APiQypKzyRsi8F4KN/SgIV+ZH2kbz70MaLarpIWDqq3Rg/r1Er7e0kVkZlf1o7FdQ83E10GYE7iRCw== X-Received: by 2002:ab0:3762:: with SMTP id o2mr3071693uat.119.1587653025652; Thu, 23 Apr 2020 07:43:45 -0700 (PDT) Received: from alain.c.googlers.com.com (161.138.243.35.bc.googleusercontent.com. [35.243.138.161]) by smtp.gmail.com with ESMTPSA id d83sm762107vka.34.2020.04.23.07.43.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2020 07:43:45 -0700 (PDT) From: Alain Michaud To: linux-bluetooth@vger.kernel.org Cc: Alain Michaud Subject: [PATCH v3 2/3] bluetooth:allow scatternet connections if supported. Date: Thu, 23 Apr 2020 14:43:29 +0000 Message-Id: <20200423144328.82478-3-alainm@chromium.org> X-Mailer: git-send-email 2.26.1.301.g55bc3eb7cb9-goog In-Reply-To: <20200423144328.82478-1-alainm@chromium.org> References: <20200423144328.82478-1-alainm@chromium.org> MIME-Version: 1.0 Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org This change allows scatternet connections to be created if the controller reports support and the HCI_QUIRK_VALID_LE_STATES indicates that the reported LE states can be trusted. Signed-off-by: Alain Michaud --- net/bluetooth/hci_event.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 0a591be8b0ae..830688612e05 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -5245,7 +5245,9 @@ static struct hci_conn *check_pending_le_conn(struct hci_dev *hdev, /* Most controller will fail if we try to create new connections * while we have an existing one in slave role. */ - if (hdev->conn_hash.le_num_slave > 0) + if (hdev->conn_hash.le_num_slave > 0 && + (!test_bit(HCI_QUIRK_VALID_LE_STATES, &hdev->quirks) || + !(hdev->le_states[3] & 0x10))) return NULL; /* If we're not connectable only connect devices that we have in From patchwork Thu Apr 23 14:43:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alain Michaud X-Patchwork-Id: 11505829 X-Patchwork-Delegate: marcel@holtmann.org 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 952D214DD for ; Thu, 23 Apr 2020 14:43:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7E49E2098B for ; Thu, 23 Apr 2020 14:43:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="e0YXc6jk" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728297AbgDWOn4 (ORCPT ); Thu, 23 Apr 2020 10:43:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726380AbgDWOnz (ORCPT ); Thu, 23 Apr 2020 10:43:55 -0400 Received: from mail-ua1-x942.google.com (mail-ua1-x942.google.com [IPv6:2607:f8b0:4864:20::942]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC70AC08E934 for ; Thu, 23 Apr 2020 07:43:54 -0700 (PDT) Received: by mail-ua1-x942.google.com with SMTP id c17so5884784uae.12 for ; Thu, 23 Apr 2020 07:43:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KGjHlHj2yLZ30uJ1TR1oOXoayTLW/J80Sb28kEteyy8=; b=e0YXc6jk4BECICTBKHOujB3/h2gy6FK1YB9/i5hoLOBXzDnjJWx+1bHUufDBDwBLHN oQyVXr2uB83EjqvXhjT4zxGI1vwpIzYXdwlnJMcm4tVHdhTBKwOlX2O8ndU81/4Bw8IY fG1t2DPcXi0HVtPHmbnFtY8HLinIjqrEU2OZU= 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=KGjHlHj2yLZ30uJ1TR1oOXoayTLW/J80Sb28kEteyy8=; b=XbMpgoh9/WEoyD/G/mEg8aQeLJdtdYdbeQifeCjxeoU2E1AetjuNiX/M6ANt1pWPlE 2LGYf97fRr2itGiWsYgoeDRYEOlgL1A1WCKjWfOj6uMViD8dPw5avD97uoIqPTkEY84b nGhdVPaDJx6Txuvy2TfKvX0A2fr+b+pULopkpmwU6EFocWMxmw3VU8Nq1OFk9yjxm2oX NDn7elUH8nMrE2rD/mUfLG98ZtE5E9i0rpP9o+vSmRY0QGvOsvQuvGNriNEwKBk+NQAL gn43ycan2Pf7qS38RJr0ccoVPZNG0R4m+lnfFIb2kZBBakmGwPFOZXkYrLJ3c5KxpAMu /JLA== X-Gm-Message-State: AGi0Pua7Oxulu8hnkBsO8Gv9MndQVxVOJSL7zOUJ9TJYmwYYhfcx0nKW aUhaboi3l+OVuADErivcJbDnMrAQ8lQ= X-Google-Smtp-Source: APiQypLC6nXVkzMgxPJeFkuR51s4MJewdxEKy56D0OznkAs6Sv3D3dACwCKEj/20TlXA6fEnA1AvuQ== X-Received: by 2002:a05:6102:4d:: with SMTP id k13mr3488005vsp.198.1587653033644; Thu, 23 Apr 2020 07:43:53 -0700 (PDT) Received: from alain.c.googlers.com.com (161.138.243.35.bc.googleusercontent.com. [35.243.138.161]) by smtp.gmail.com with ESMTPSA id d83sm762107vka.34.2020.04.23.07.43.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2020 07:43:53 -0700 (PDT) From: Alain Michaud To: linux-bluetooth@vger.kernel.org Cc: Alain Michaud Subject: [PATCH v3 3/3] bluetooth:btusb: Adding support for LE scatternet to Jfp and ThP Date: Thu, 23 Apr 2020 14:43:31 +0000 Message-Id: <20200423144328.82478-4-alainm@chromium.org> X-Mailer: git-send-email 2.26.1.301.g55bc3eb7cb9-goog In-Reply-To: <20200423144328.82478-1-alainm@chromium.org> References: <20200423144328.82478-1-alainm@chromium.org> MIME-Version: 1.0 Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org This change adds support for LE scatternet connections to Intel's JfP and ThP controllers. Signed-off-by: Alain Michaud --- drivers/bluetooth/btusb.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index dd27e28d4601..d801c332b85a 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -335,7 +335,8 @@ static const struct usb_device_id blacklist_table[] = { /* Intel Bluetooth devices */ { USB_DEVICE(0x8087, 0x0025), .driver_info = BTUSB_INTEL_NEW | - BTUSB_WIDEBAND_SPEECH }, + BTUSB_WIDEBAND_SPEECH | + BTUSB_VALID_LE_STATES }, { USB_DEVICE(0x8087, 0x0026), .driver_info = BTUSB_INTEL_NEW | BTUSB_WIDEBAND_SPEECH }, { USB_DEVICE(0x8087, 0x0029), .driver_info = BTUSB_INTEL_NEW | @@ -348,7 +349,8 @@ static const struct usb_device_id blacklist_table[] = { { USB_DEVICE(0x8087, 0x0aa7), .driver_info = BTUSB_INTEL | BTUSB_WIDEBAND_SPEECH }, { USB_DEVICE(0x8087, 0x0aaa), .driver_info = BTUSB_INTEL_NEW | - BTUSB_WIDEBAND_SPEECH }, + BTUSB_WIDEBAND_SPEECH | + BTUSB_VALID_LE_STATES }, /* Other Intel Bluetooth devices */ { USB_VENDOR_AND_INTERFACE_INFO(0x8087, 0xe0, 0x01, 0x01), @@ -3877,6 +3879,9 @@ static int btusb_probe(struct usb_interface *intf, if (id->driver_info & BTUSB_WIDEBAND_SPEECH) set_bit(HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED, &hdev->quirks); + if (id->driver_info & BTUSB_VALID_LE_STATES) + set_bit(HCI_QUIRK_VALID_LE_STATES, &hdev->quirks); + if (id->driver_info & BTUSB_DIGIANSWER) { data->cmdreq_type = USB_TYPE_VENDOR; set_bit(HCI_QUIRK_RESET_ON_CLOSE, &hdev->quirks);