Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH BlueZ v1 0/9] Add support for HDT and EKS
@ 2026-11-03 22:19 Luiz Augusto von Dentz
  2026-11-03 22:19 ` [PATCH BlueZ v1 1/9] lib: Add HDT definitions Luiz Augusto von Dentz
                   ` (8 more replies)
  0 siblings, 9 replies; 13+ messages in thread
From: Luiz Augusto von Dentz @ 2026-11-03 22:19 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This adds userspace support for High Data Throughput (HDT) and Encryption
Key Schedule (EKS), introduced in Bluetooth Core 7.0:

 - lib: BT_PHY bits for the HDT rates (HDT2, HDT3, HDT4, HDT6 and
   HDT7.5), bt_security.mic_len to request and read the MIC length of a
   link, and struct bt_iso_qos_v2 adding the rates to BT_ISO_QOS.
 - btmon: decoding of the HDT and EKS HCI commands, events, feature bits
   and supported commands bits, the LL_ENC_ECDH_*, LL_HDT_CONFIG_* and
   LL_HDT_LQF_REPORTING_IND PDUs, the MIC Length Too Short results of
   L2CAP and ATT, and the new MGMT setting and system configuration TLVs.
 - emulator: a 7.0 controller type for btdev, which implements HDT and
   EKS and is now the default for btvirt (btvirt --core 7.0), and bthost
   helpers to drive the HDT PHY and the MIC length from the remote side.
 - GATT: MIC length permissions for characteristics and descriptors,
   rejecting access with MIC Length Too Short when the link uses a
   shorter MIC.
 - main.conf: an [HDT] group setting the default MIC length, packet
   format, rates and EKS opportunistic encryption through the MGMT
   system configuration TLVs.
 - l2test: options to select the PHY, including the HDT rates, and the
   MIC length.

The kernel changes are posted to linux-bluetooth as:

  [PATCH v1 0/6] Bluetooth: Add support for HDT and EKS

and are required for the HDT tests, the socket options, MGMT setting and
system configuration TLVs used here.

Test coverage, all passing against the kernel series on top of
bluetooth-next:

 - l2cap-tester: 30 new tests, connections on each HDT rate for LE and
   Enhanced Credit Based, MIC Length Too Short and MIC length downgrade
   on re-encryption (141/141 total).
 - iso-tester: 68 new tests, CIS and BIS on each HDT rate, receiving on
   HDT and the default MIC length (209/209 total).
 - mgmt-tester: 7 new tests, the HDT and SCI settings on 7.0 controllers,
   the HDT default parameters and EKS opportunistic encryption system
   configuration (522/522 total).
 - unit/test-gatt: 8 new tests, MIC length permission checks for each
   read and write request (205/205 total).
 - make check-functional: the existing tests pass with the 7.0
   controllers btvirt now defaults to (53 passed, 1 skipped).

Luiz Augusto von Dentz (9):
  lib: Add HDT definitions
  monitor: Add HCI decoding for HDT
  monitor: Add LL decoding for HDT
  emulator: Add HDT support to btdev
  emulator: Add HDT support to bthost
  shared/gatt: Add MIC length permission checks
  main.conf: Add HDT configuration
  l2cap-tester, iso-tester, mgmt-tester: Add HDT tests
  l2test: Add HDT options

 client/scripts/gatt-mic-128.bt       |    5 +
 client/scripts/gatt-mic-64-128.bt    |    7 +
 client/scripts/gatt-mic-64.bt        |    5 +
 doc/l2cap-protocol.rst               |   42 +-
 doc/mgmt-protocol.rst                |    3 +
 doc/org.bluez.GattCharacteristic.rst |    4 +
 doc/org.bluez.GattDescriptor.rst     |    4 +
 emulator/btdev.c                     |  816 ++++++++++++++++-
 emulator/btdev.h                     |    1 +
 emulator/bthost.c                    |   99 ++
 emulator/bthost.h                    |   14 +
 emulator/hciemu.c                    |    3 +
 emulator/hciemu.h                    |    1 +
 emulator/main.c                      |    5 +-
 lib/bluetooth/bluetooth.h            |   85 +-
 monitor/att.c                        |    3 +
 monitor/bt.h                         |  414 +++++++++
 monitor/l2cap.c                      |    6 +
 monitor/ll.c                         |  331 ++++++-
 monitor/packet.c                     |  872 +++++++++++++++++-
 src/adapter.c                        |   28 +
 src/btd.h                            |    7 +
 src/gatt-database.c                  |   26 +
 src/main.c                           |   33 +
 src/main.conf                        |   27 +
 src/shared/att-types.h               |   17 +-
 src/shared/att.c                     |   39 +
 src/shared/att.h                     |    3 +
 src/shared/gatt-db.c                 |    9 +
 src/shared/gatt-db.h                 |    3 +
 src/shared/gatt-server.c             |   22 +
 tools/iso-tester.c                   | 1274 +++++++++++++++++++++++++-
 tools/l2cap-tester.c                 |  685 ++++++++++++++
 tools/l2test.c                       |  139 ++-
 tools/mgmt-tester.c                  |  170 ++++
 unit/test-gatt.c                     |  101 ++
 36 files changed, 5185 insertions(+), 118 deletions(-)
 create mode 100644 client/scripts/gatt-mic-128.bt
 create mode 100644 client/scripts/gatt-mic-64-128.bt
 create mode 100644 client/scripts/gatt-mic-64.bt

-- 
2.56.0


^ permalink raw reply	[flat|nested] 13+ messages in thread
* [PATCH BlueZ v2 1/9] lib: Add HDT definitions
@ 2026-11-04 18:36 Luiz Augusto von Dentz
  2026-11-04 23:07 ` Add support for HDT and EKS bluez.test.bot
  0 siblings, 1 reply; 13+ messages in thread
From: Luiz Augusto von Dentz @ 2026-11-04 18:36 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

Add the socket API needed for the LE HDT PHY:

- BT_PHY bits for the HDT2, HDT3, HDT4, HDT6 and HDT7.5 rates in each
  direction, with the existing bits converted to BIT() for consistency
- bt_security.mic_len to request and read the MIC length of a link
- struct bt_iso_qos_v2, which adds the rates field to the ISO QoS
  passed with BT_ISO_QOS
---
 lib/bluetooth/bluetooth.h | 65 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 65 insertions(+)

diff --git a/lib/bluetooth/bluetooth.h b/lib/bluetooth/bluetooth.h
index f9f22c3f7523..e9ed2f2f2a19 100644
--- a/lib/bluetooth/bluetooth.h
+++ b/lib/bluetooth/bluetooth.h
@@ -53,6 +53,7 @@ extern "C" {
 struct bt_security {
 	uint8_t level;
 	uint8_t key_size;
+	uint8_t mic_len;
 };
 #define BT_SECURITY_SDP		0
 #define BT_SECURITY_LOW		1
@@ -130,6 +131,16 @@ struct bt_voice {
 #define BT_PHY_LE_2M_RX		0x00001000
 #define BT_PHY_LE_CODED_TX	0x00002000
 #define BT_PHY_LE_CODED_RX	0x00004000
+#define BT_PHY_HDT_2M_TX	0x00008000
+#define BT_PHY_HDT_2M_RX	0x00010000
+#define BT_PHY_HDT_3M_TX	0x00020000
+#define BT_PHY_HDT_3M_RX	0x00040000
+#define BT_PHY_HDT_4M_TX	0x00080000
+#define BT_PHY_HDT_4M_RX	0x00100000
+#define BT_PHY_HDT_6M_TX	0x00200000
+#define BT_PHY_HDT_6M_RX	0x00400000
+#define BT_PHY_HDT_7_5M_TX	0x00800000
+#define BT_PHY_HDT_7_5M_RX	0x01000000
 
 #define BT_MODE			15
 
@@ -219,6 +230,60 @@ struct bt_iso_qos {
 	};
 };
 
+/* Extended ISO QoS, set and read with BT_ISO_QOS: the option length tells it
+ * apart from struct bt_iso_qos, and version tells which fields follow.
+ *
+ * Version 1 adds the rates of each direction, set when the PHY is
+ * BT_ISO_PHY_HDT.
+ */
+#define BT_ISO_QOS_VERSION_1	0x01
+
+struct bt_iso_io_qos_ext {
+	uint32_t interval;
+	uint16_t latency;
+	uint16_t sdu;
+	uint8_t  phys;
+	uint8_t  rtn;
+	uint16_t rates;
+};
+
+struct bt_iso_ucast_qos_ext {
+	uint8_t  cig;
+	uint8_t  cis;
+	uint8_t  sca;
+	uint8_t  packing;
+	uint8_t  framing;
+	struct bt_iso_io_qos_ext in;
+	struct bt_iso_io_qos_ext out;
+};
+
+struct bt_iso_bcast_qos_ext {
+	uint8_t  big;
+	uint8_t  bis;
+	uint8_t  sync_factor;
+	uint8_t  packing;
+	uint8_t  framing;
+	struct bt_iso_io_qos_ext in;
+	struct bt_iso_io_qos_ext out;
+	uint8_t  encryption;
+	uint8_t  bcode[16];
+	uint8_t  options;
+	uint16_t skip;
+	uint16_t sync_timeout;
+	uint8_t  sync_cte_type;
+	uint8_t  mse;
+	uint16_t timeout;
+};
+
+struct bt_iso_qos_ext {
+	uint8_t  version;
+	uint8_t  rfu[3];
+	union {
+		struct bt_iso_ucast_qos_ext ucast;
+		struct bt_iso_bcast_qos_ext bcast;
+	};
+};
+
 #define BT_CODEC		19
 struct bt_codec {
 	uint8_t id;
-- 
2.56.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread
* [PATCH BlueZ v3 01/10] lib: Add HDT definitions
@ 2026-11-04 22:20 Luiz Augusto von Dentz
  2026-11-05  3:06 ` Add support for HDT and EKS bluez.test.bot
  0 siblings, 1 reply; 13+ messages in thread
From: Luiz Augusto von Dentz @ 2026-11-04 22:20 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

Add the socket API needed for the LE HDT PHY:

- BT_PHY bits for the HDT2, HDT3, HDT4, HDT6 and HDT7.5 rates in each
  direction.
- bt_security.mic_len to request and read the MIC length of a link.
- struct bt_iso_qos_ext, an extensible ISO QoS passed with BT_ISO_QOS
  and told apart from struct bt_iso_qos by its length, along with the
  BT_ISO_PHY_* values and BT_ISO_HDT_RATE_* for its rates field.

struct bt_iso_qos_ext is meant to grow rather than adding new socket
options or structs, which is what its first two fields are for:

- version tells which fields are valid, so later versions can add
  fields while applications built for an earlier version keep working.
  Version 1 adds the HDT rates of each direction.
- type tells which member of the union is in use, unicast or
  broadcast. The QoS is usually set before bind() or connect(), when
  the kernel can't tell which one it was given, so with type each can
  grow on its own by adding fields at its end, which is also why the
  union is the last member. BT_ISO_QOS_ANY leaves it to connect() or
  listen().
---
 lib/bluetooth/bluetooth.h | 100 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 100 insertions(+)

diff --git a/lib/bluetooth/bluetooth.h b/lib/bluetooth/bluetooth.h
index f9f22c3f7523..dc05df21cd23 100644
--- a/lib/bluetooth/bluetooth.h
+++ b/lib/bluetooth/bluetooth.h
@@ -53,6 +53,7 @@ extern "C" {
 struct bt_security {
 	uint8_t level;
 	uint8_t key_size;
+	uint8_t mic_len;
 };
 #define BT_SECURITY_SDP		0
 #define BT_SECURITY_LOW		1
@@ -130,6 +131,16 @@ struct bt_voice {
 #define BT_PHY_LE_2M_RX		0x00001000
 #define BT_PHY_LE_CODED_TX	0x00002000
 #define BT_PHY_LE_CODED_RX	0x00004000
+#define BT_PHY_HDT_2M_TX	0x00008000
+#define BT_PHY_HDT_2M_RX	0x00010000
+#define BT_PHY_HDT_3M_TX	0x00020000
+#define BT_PHY_HDT_3M_RX	0x00040000
+#define BT_PHY_HDT_4M_TX	0x00080000
+#define BT_PHY_HDT_4M_RX	0x00100000
+#define BT_PHY_HDT_6M_TX	0x00200000
+#define BT_PHY_HDT_6M_RX	0x00400000
+#define BT_PHY_HDT_7_5M_TX	0x00800000
+#define BT_PHY_HDT_7_5M_RX	0x01000000
 
 #define BT_MODE			15
 
@@ -219,6 +230,95 @@ struct bt_iso_qos {
 	};
 };
 
+/* Extended ISO QoS, set and read with BT_ISO_QOS.
+ *
+ * The option length tells it apart from struct bt_iso_qos, which is kept for
+ * existing applications. New fields are added by extending this struct rather
+ * than by adding new socket options or structs:
+ *
+ * - version tells which fields are valid, so later versions can add fields
+ *   while older applications keep working with the fields they know.
+ * - type tells which member of the union is in use. The QoS is usually set
+ *   before bind() or connect(), so the socket can't tell unicast from
+ *   broadcast at that point. With type, struct bt_iso_ucast_qos_ext and
+ *   struct bt_iso_bcast_qos_ext can each grow on their own, by adding fields
+ *   at their end, without the kernel having to guess which one it was given.
+ *   For that the union shall remain the last member.
+ *
+ * BT_ISO_QOS_ANY leaves the type to be set by connect() or listen(), which is
+ * possible with version 1 since its unicast fields are a prefix of the
+ * broadcast ones. A type that doesn't match how the socket is used makes
+ * connect() or listen() fail with -EINVAL. getsockopt() reports the type in
+ * use once it is known.
+ *
+ * Version 1 adds the HDT rates of each direction, see BT_ISO_HDT_RATE_*, used
+ * when the PHY is BT_ISO_PHY_HDT; 0 means every rate the controller supports.
+ */
+#define BT_ISO_QOS_VERSION_1	0x0001
+
+#define BT_ISO_QOS_ANY		0x0000
+#define BT_ISO_QOS_UCAST	0x0001
+#define BT_ISO_QOS_BCAST	0x0002
+
+#define BT_ISO_HDT_RATE_2M	0x0001
+#define BT_ISO_HDT_RATE_3M	0x0002
+#define BT_ISO_HDT_RATE_4M	0x0004
+#define BT_ISO_HDT_RATE_6M	0x0008
+#define BT_ISO_HDT_RATE_7_5M	0x0010
+
+#define BT_ISO_PHY_1M		0x01
+#define BT_ISO_PHY_2M		0x02
+#define BT_ISO_PHY_CODED	0x04
+#define BT_ISO_PHY_HDT		0x10
+#define BT_ISO_PHY_ANY		(BT_ISO_PHY_1M | BT_ISO_PHY_2M | \
+				 BT_ISO_PHY_CODED)
+
+struct bt_iso_io_qos_ext {
+	uint32_t interval;
+	uint16_t latency;
+	uint16_t sdu;
+	uint8_t  phys;
+	uint8_t  rtn;
+	uint16_t rates;
+};
+
+struct bt_iso_ucast_qos_ext {
+	uint8_t  cig;
+	uint8_t  cis;
+	uint8_t  sca;
+	uint8_t  packing;
+	uint8_t  framing;
+	struct bt_iso_io_qos_ext in;
+	struct bt_iso_io_qos_ext out;
+};
+
+struct bt_iso_bcast_qos_ext {
+	uint8_t  big;
+	uint8_t  bis;
+	uint8_t  sync_factor;
+	uint8_t  packing;
+	uint8_t  framing;
+	struct bt_iso_io_qos_ext in;
+	struct bt_iso_io_qos_ext out;
+	uint8_t  encryption;
+	uint8_t  bcode[16];
+	uint8_t  options;
+	uint16_t skip;
+	uint16_t sync_timeout;
+	uint8_t  sync_cte_type;
+	uint8_t  mse;
+	uint16_t timeout;
+};
+
+struct bt_iso_qos_ext {
+	uint16_t version;
+	uint16_t type;
+	union {	/* Shall be the last member */
+		struct bt_iso_ucast_qos_ext ucast;
+		struct bt_iso_bcast_qos_ext bcast;
+	};
+};
+
 #define BT_CODEC		19
 struct bt_codec {
 	uint8_t id;
-- 
2.56.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2026-11-05  3:06 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-03 22:19 [PATCH BlueZ v1 0/9] Add support for HDT and EKS Luiz Augusto von Dentz
2026-11-03 22:19 ` [PATCH BlueZ v1 1/9] lib: Add HDT definitions Luiz Augusto von Dentz
2026-11-04  2:34   ` Add support for HDT and EKS bluez.test.bot
2026-11-03 22:19 ` [PATCH BlueZ v1 2/9] monitor: Add HCI decoding for HDT Luiz Augusto von Dentz
2026-11-03 22:19 ` [PATCH BlueZ v1 3/9] monitor: Add LL " Luiz Augusto von Dentz
2026-11-03 22:19 ` [PATCH BlueZ v1 4/9] emulator: Add HDT support to btdev Luiz Augusto von Dentz
2026-11-03 22:19 ` [PATCH BlueZ v1 5/9] emulator: Add HDT support to bthost Luiz Augusto von Dentz
2026-11-03 22:19 ` [PATCH BlueZ v1 6/9] shared/gatt: Add MIC length permission checks Luiz Augusto von Dentz
2026-11-03 22:19 ` [PATCH BlueZ v1 7/9] main.conf: Add HDT configuration Luiz Augusto von Dentz
2026-11-03 22:19 ` [PATCH BlueZ v1 8/9] l2cap-tester, iso-tester, mgmt-tester: Add HDT tests Luiz Augusto von Dentz
2026-11-03 22:19 ` [PATCH BlueZ v1 9/9] l2test: Add HDT options Luiz Augusto von Dentz
  -- strict thread matches above, loose matches on Subject: below --
2026-11-04 18:36 [PATCH BlueZ v2 1/9] lib: Add HDT definitions Luiz Augusto von Dentz
2026-11-04 23:07 ` Add support for HDT and EKS bluez.test.bot
2026-11-04 22:20 [PATCH BlueZ v3 01/10] lib: Add HDT definitions Luiz Augusto von Dentz
2026-11-05  3:06 ` Add support for HDT and EKS bluez.test.bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox