Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp1797629rdb; Thu, 25 Jan 2024 06:31:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IFPYgbcQzb0XCwAu8c/4eY8h3IUcpUQ/sIIYwPx1MIZUbsAgjUPr3kXobCmRaosYp205fLl X-Received: by 2002:aa7:d80a:0:b0:55c:3668:c3c6 with SMTP id v10-20020aa7d80a000000b0055c3668c3c6mr990639edq.34.1706193089453; Thu, 25 Jan 2024 06:31:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706193089; cv=pass; d=google.com; s=arc-20160816; b=DMYbQKGCrdh4LtN57GL19bjuBZ1lvBDSsnJW+iffTjBLforGX+jfAX7EkeiJPx+6RP HiHoOTWQxS4LKBOYNfSwhssSwMgygkwSTYgOQ6kcspj+DU6nwTFH4KLuALXb+Oox0VYv 8nS5s/PME5ZELM5Gnc1EyiGVaEHxomVgvlh6ltSehu3oNeO/VG0N8fmUnOtI3RxPyEbE ZPJEEkiPJLxkgRuUOEY5UYZfRL7kk4amtbCI+RbJDs8Cupsh/baIWKvHQTRBuMhjF8mR eWBvVAsQx0K32m02LCCED48zUmsPR072BpMoQQ1lxw9HqOlnBMzPQaUSxaUd8YJd0Qon 2Jdg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=sFPaXhTHCFOuwEindCMvIJ/B6iM55ZV6WYswliZCmCE=; fh=doZmmohy0rAGRkfGdstB05vqIeLLh8Rb4PJ2mjF9egE=; b=RJwuVIpUgBHh6fEnNDpUpc9LtNvnlyI6TIVPzkY00482xYHD5NoUSrPpwWY24NDn/O O7eSxjArb6c4igWo+JcvevrRwNHrHGKr4IRvKw+R04aEO0MXf4ouwclUfvBIXiyLrvAI 0vc2QtN8A0yIjgju9VFDS/14ghMvtnFAa4fWf+5Mt1JNPFVI3dYxgDx2sqpGRaUAZKSu gSYdCDHBo3iK74doYr9ciNYWbjj4Xj+oKecwM862BIF/4J8NJ1C/OxAcrI5NTVnEyCL2 J2Bsblrj1kmAdJ9t99+MtPHylnCqkswsyfFE9GFI1UpCnuDEdgj++i2utx2SCSKyOhEI IGNw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=UzVSrAk3; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-bluetooth+bounces-1370-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-1370-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id fj6-20020a0564022b8600b0055a82bbb2dfsi6576454edb.39.2024.01.25.06.31.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 06:31:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-1370-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=UzVSrAk3; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-bluetooth+bounces-1370-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-1370-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id AF7F81F25E47 for ; Thu, 25 Jan 2024 14:31:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 912FA67E66; Thu, 25 Jan 2024 14:31:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UzVSrAk3" X-Original-To: linux-bluetooth@vger.kernel.org Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 61B9667A17 for ; Thu, 25 Jan 2024 14:31:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706193069; cv=none; b=TXkD5mdlyFE8pMbFoIywNAJIEcSdu17WYnBkbZN6n7Sqy0o0PX/5lar0XXG4B6SYEFQozT/rMleMcSlpkM1HnpkLLYUUubKoJIrYxhgKFdvAFdJ5pd4HVxUvQsV57tMdIKIlZ30lpV2xGHXDGJIImLCDMoF7uyG5mwRZpgH/lFA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706193069; c=relaxed/simple; bh=6G3wLYmPlT9gPDy1pV7AGAtrUy/t2qA82IE4QoskQWY=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=D4WeM8yVgCHmaN+2cFvMptx4VaJMz/I0Kvl7YeN6b7Qllmuu4ftWdmePkMrUrHXmJrfKfc8c7jLCDT00QJ6PRdoYjurZMFg7ydbDOEn1lCdH6ZNQCIWky6D0GVUKRnStqOSXoqUD9wz/VYkLypm03n/cDV5VQ9TsQrRd9cwfO0E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=UzVSrAk3; arc=none smtp.client-ip=209.85.221.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-33926ccbc80so4361812f8f.0 for ; Thu, 25 Jan 2024 06:31:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706193065; x=1706797865; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=sFPaXhTHCFOuwEindCMvIJ/B6iM55ZV6WYswliZCmCE=; b=UzVSrAk3DfEJMxMYFSXuQNkHmavE9t7tpO1XZPxRUdu2rVvmjsC30cY3YXKziIp0Oy Owy20YsH3naF8qf2AOVfm7F6WHE4TT6tQGEAWDL1dSnKZ4IrjgkFydmqg+CVwfScqmFt /yKiulhgag2gSEIt9wg1qttc7M7Sg3BiN+TtlraSWi6O2+XPgww7c6rDB47TezbHaDgl FdRzUYa/DGnZj2s1ZB4XMFdg+zEXjIcWGogRZkfnKBDG1DCKn66STJXkakzYrvbXwxL3 iOcc3LBLzj3QcU1/FU4SL9Duqn72L189qtA+qazzW63etmBl5op/QSBdjwM1jLt6/xRk pEWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706193065; x=1706797865; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sFPaXhTHCFOuwEindCMvIJ/B6iM55ZV6WYswliZCmCE=; b=GpBgeKVl5rfEtR0/KbW56CTxcEOrAs6U78nHmD1zFGp7fHl2QTmDxUPWp9uPFYXTbn KPWV4lUAB6/U4znwCwFToCK+VTle/W4/XMkbSjBMYl5LPrluY2rnzlUGZ4XFiYDR1YAH gISAsRUX9LeWQC6g5+NGjObEaZeX70tvTcdHIIpc4/3AXCP2PD6GSLT45mZ/AdMnVogF ZCP2q8Gitr0J2+Iu/pxxIvfuQu9c5FiRfz+gKSsk2zgsxbPD33UGbAQu4dAFlVsPcveS msgRTBvHi8wAy2nLgGGG3haq3XH16G0lEUYPKrPnrMD3jbYmLsYgr9b9c7ETASHPtLxq H5jg== X-Gm-Message-State: AOJu0YzFw/3OcPrj9Nu7F62k4r0toqx3hdvC7390YyQMy8ZK97Iiyw3n pvfT1vEECn0g4D45qZYeY+yPJAfdWDzNLE7ct6Vh/OHs1W8tpK0apKAKKYnyGydMUWXnUcJ6VTT qI2TyGqqyrUlfYoX1NeGWizeAIow= X-Received: by 2002:a5d:624b:0:b0:337:c595:88f5 with SMTP id m11-20020a5d624b000000b00337c59588f5mr1015090wrv.16.1706193065455; Thu, 25 Jan 2024 06:31:05 -0800 (PST) Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: In-Reply-To: From: Emil Lenngren Date: Thu, 25 Jan 2024 15:30:53 +0100 Message-ID: Subject: Re: Wrong order of ACL Data and HCI Event packets for HCI over USB To: Luiz Augusto von Dentz Cc: Bluez mailing list Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Luiz and thanks for the quick answer! In the meantime I modified the remote device's code to add a short delay after connection establishment that also seems to work around the issue. Do you have any idea if this design flaw will be fixed in the specification? Seems like a pretty bad one to me... /Emil Den tors 25 jan. 2024 kl 15:25 skrev Luiz Augusto von Dentz : > > Hi Emil, > > On Thu, Jan 25, 2024 at 8:51=E2=80=AFAM Emil Lenngren wrote: > > > > Hi. I have a quite annoying issue on my Ubuntu 22.04 computer with an > > Intel Bluetooth controller (8087:0033, Intel Wi-Fi 6E (6GHz) AX211 2x2 > > Bluetooth 5.2 Wireless Card). > > Very often BLE connections to a particular device behaves incorrectly > > (ATT timeout by remote device) because the initial ATT Exchange MTU > > Request arrives to the host (BlueZ) just before the LE Enhanced > > Connection Complete event arrives, and is therefore dropped. I guess > > this is due to separate endpoints and therefore separate flows are > > used in the HCI USB protocol, but have no idea how/if this can be > > fixed? > > > > See btmon log: > > > > < HCI Command: LE Set Extended Advertising En.. (0x08|0x0039) plen 6 > > #11 [hci0] 8.102056 > > Extended advertising: Enabled (0x01) > > Number of sets: 1 (0x01) > > Entry 0 > > Handle: 0x01 > > Duration: 0 ms (0x00) > > Max ext adv events: 0 > > > HCI Event: Command Complete (0x0e) plen 4 #= 12 [hci0] 8.104041 > > LE Set Extended Advertising Enable (0x08|0x0039) ncmd 2 > > Status: Success (0x00) > > @ MGMT Event: Command Complete (0x0001) plen 4 > > {0x0001} [hci0] 8.104053 > > Add Extended Advertising Data (0x0055) plen 1 > > Status: Success (0x00) > > Instance: 1 > > > ACL Data RX: Handle 3585 flags 0x02 dlen 7 #1= 3 [hci0] 21.049023 > > ATT: Exchange MTU Request (0x02) len 2 > > Client RX MTU: 247 > > > HCI Event: LE Meta Event (0x3e) plen 31 #1= 4 [hci0] 21.049304 > > LE Enhanced Connection Complete (0x0a) > > Status: Success (0x00) > > Handle: 3585 > > Role: Peripheral (0x01) > > Peer address type: Public (0x00) > > Peer address: (removed) > > Local resolvable private address: 00:00:00:00:00:00 (Non-Resolva= ble) > > Peer resolvable private address: 00:00:00:00:00:00 (Non-Resolvab= le) > > Connection interval: 25.00 msec (0x0014) > > Connection latency: 0 (0x0000) > > Supervision timeout: 700 msec (0x0046) > > Central clock accuracy: 0x00 > > @ MGMT Event: Device Connected (0x000b) plen 13 > > {0x0001} [hci0] 21.049366 > > LE Address: (removed) > > Flags: 0x00000000 > > Data length: 0 > > < HCI Command: LE Read Remote Used Features (0x08|0x0016) plen 2 > > #15 [hci0] 21.049405 > > Handle: 3585 > > > HCI Event: LE Meta Event (0x3e) plen 4 #1= 6 [hci0] 21.050229 > > LE Channel Selection Algorithm (0x14) > > Handle: 3585 > > Algorithm: #2 (0x01) > > > HCI Event: LE Meta Event (0x3e) plen 6 #1= 7 [hci0] 21.051290 > > LE Advertising Set Terminated (0x12) > > Status: Success (0x00) > > Handle: 1 > > Connection handle: 3585 > > Number of completed extended advertising events: 0 > > > HCI Event: LE Meta Event (0x3e) plen 11 #1= 8 [hci0] 21.052293 > > LE Data Length Change (0x07) > > Handle: 3585 > > Max TX octets: 251 > > Max TX time: 2120 > > Max RX octets: 251 > > Max RX time: 2120 > > > HCI Event: Command Status (0x0f) plen 4 #1= 9 [hci0] 21.053228 > > LE Read Remote Used Features (0x08|0x0016) ncmd 1 > > Status: Success (0x00) > > This is a design flaw in the Bluetooth Core Specification, it defines > different USB endpoints for data and events but since they don't come > with any timestamp from the controller the host has no idea about > their order. That said we do provide a workaround that can be enabled > with the use of the following config option: > > config BT_HCIBTUSB_POLL_SYNC > bool "Enable USB poll_sync for Bluetooth USB devices by default" > depends on BT_HCIBTUSB > default y > help > poll_sync synchronizes the USB data and event endpoints by > prioritizing the later. > > Say Y here to enable USB poll_sync for Bluetooth USB devices by > default. > > -- > Luiz Augusto von Dentz