Linux wireless drivers development
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali@kernel.org>
To: "Jonas Dreßler" <verdre@v0yd.nl>
Cc: Amitkumar Karwar <amitkarwar@gmail.com>,
	Ganapathi Bhat <ganapathi017@gmail.com>,
	Xinming Hu <huxinming820@gmail.com>,
	Kalle Valo <kvalo@codeaurora.org>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Marcel Holtmann <marcel@holtmann.org>,
	Johan Hedberg <johan.hedberg@gmail.com>,
	Luiz Augusto von Dentz <luiz.dentz@gmail.com>,
	Tsuchiya Yuto <kitakar@gmail.com>,
	linux-wireless@vger.kernel.org, linux-bluetooth@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Maximilian Luz <luzmaximilian@gmail.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: Re: [PATCH] Bluetooth: btusb: Lower passive lescan interval on Marvell 88W8897
Date: Fri, 17 Sep 2021 14:30:57 +0200	[thread overview]
Message-ID: <20210917123057.gqitcxvxn4ax25np@pali> (raw)
In-Reply-To: <20210917122718.86776-1-verdre@v0yd.nl>

On Friday 17 September 2021 14:27:18 Jonas Dreßler wrote:
> The Marvell 88W8897 combined wifi and bluetooth card (pcie+usb version)
> is used in a lot of Microsoft Surface devices, and all those devices
> suffer from very low 2.4GHz wifi connection speeds while bluetooth is
> enabled.

Hello! Do you know if this issue is specific only to this one Marvell
88W8897 chip or if this issue affects also other Marvell wifi+bt combo
chips?

> The reason for that is that the default passive scanning
> interval for Bluetooth Low Energy devices is quite high on Linux
> (interval of 60 msec and scan window of 30 msec, see le_scan_interval
> and le_scan_window in hci_core.c), and the Marvell chip is known for its
> bad bt+wifi coexisting performance.
> 
> So decrease that passive scan interval and make the scan window shorter
> on this particular device to allow for spending more time transmitting
> wifi signals: The new scan interval is 250 msec (0x190 * 0.625 msec) and
> the new scan window is 6.25 msec (0xa * 0.625 msec).
> 
> This change has a very large impact on the 2.4GHz wifi speeds and gets
> it up to performance comparable with the Windows driver, which seems to
> apply a similar quirk.
> 
> The scan interval and scan window length were tested and found to work
> very well with a bunch of Bluetooth Low Energy devices, including the
> Surface Pen, a Bluetooth Speaker and two modern Bluetooth headphones.
> All devices were discovered immediately after turning them on. Even
> lower values were also tested, but these introduced longer delays until
> devices get discovered.
> 
> Signed-off-by: Jonas Dreßler <verdre@v0yd.nl>
> ---
>  drivers/bluetooth/btusb.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
> index 60d2fce59a71..05b11179c839 100644
> --- a/drivers/bluetooth/btusb.c
> +++ b/drivers/bluetooth/btusb.c
> @@ -59,6 +59,7 @@ static struct usb_driver btusb_driver;
>  #define BTUSB_WIDEBAND_SPEECH	0x400000
>  #define BTUSB_VALID_LE_STATES   0x800000
>  #define BTUSB_QCA_WCN6855	0x1000000
> +#define BTUSB_LOWER_LESCAN_INTERVAL	0x2000000
>  #define BTUSB_INTEL_BROKEN_INITIAL_NCMD 0x4000000
>  
>  static const struct usb_device_id btusb_table[] = {
> @@ -356,6 +357,7 @@ static const struct usb_device_id blacklist_table[] = {
>  	{ USB_DEVICE(0x1286, 0x2044), .driver_info = BTUSB_MARVELL },
>  	{ USB_DEVICE(0x1286, 0x2046), .driver_info = BTUSB_MARVELL },
>  	{ USB_DEVICE(0x1286, 0x204e), .driver_info = BTUSB_MARVELL },
> +	{ USB_DEVICE(0x1286, 0x204c), .driver_info = BTUSB_LOWER_LESCAN_INTERVAL },
>  
>  	/* Intel Bluetooth devices */
>  	{ USB_DEVICE(0x8087, 0x0025), .driver_info = BTUSB_INTEL_COMBINED },
> @@ -3813,6 +3815,19 @@ static int btusb_probe(struct usb_interface *intf,
>  	if (id->driver_info & BTUSB_MARVELL)
>  		hdev->set_bdaddr = btusb_set_bdaddr_marvell;
>  
> +	/* The Marvell 88W8897 combined wifi and bluetooth card is known for
> +	 * very bad bt+wifi coexisting performance.
> +	 *
> +	 * Decrease the passive BT Low Energy scan interval a bit
> +	 * (0x0190 * 0.625 msec = 250 msec) and make the scan window shorter
> +	 * (0x000a * 0,625 msec = 6.25 msec). This allows for significantly
> +	 * higher wifi throughput while passively scanning for BT LE devices.
> +	 */
> +	if (id->driver_info & BTUSB_LOWER_LESCAN_INTERVAL) {
> +		hdev->le_scan_interval = 0x0190;
> +		hdev->le_scan_window = 0x000a;
> +	}
> +
>  	if (IS_ENABLED(CONFIG_BT_HCIBTUSB_MTK) &&
>  	    (id->driver_info & BTUSB_MEDIATEK)) {
>  		hdev->setup = btusb_mtk_setup;
> -- 
> 2.31.1
> 

  reply	other threads:[~2021-09-17 12:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-17 12:27 [PATCH] Bluetooth: btusb: Lower passive lescan interval on Marvell 88W8897 Jonas Dreßler
2021-09-17 12:30 ` Pali Rohár [this message]
2021-09-17 12:36   ` Jonas Dreßler
2021-09-17 12:35 ` Marcel Holtmann
2021-09-17 12:41   ` Jonas Dreßler
2021-09-17 13:18     ` Marcel Holtmann
2021-09-17 13:32       ` Jonas Dreßler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210917123057.gqitcxvxn4ax25np@pali \
    --to=pali@kernel.org \
    --cc=amitkarwar@gmail.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=davem@davemloft.net \
    --cc=ganapathi017@gmail.com \
    --cc=huxinming820@gmail.com \
    --cc=johan.hedberg@gmail.com \
    --cc=kitakar@gmail.com \
    --cc=kuba@kernel.org \
    --cc=kvalo@codeaurora.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    --cc=luzmaximilian@gmail.com \
    --cc=marcel@holtmann.org \
    --cc=verdre@v0yd.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox