From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.53 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796336063; b=zQAy139o+3/ja7ulzB/b9s21HpC6cgjIEwBS3mnvXpuONX+ZrYKYqg5JpG60dqtLtEEW +3XR2B+Re+FwZvWO3yCRQkGmcgxxNetonmTuWW5yrEHBqtaqwZZKRuuj1K6LeGmiZH28Y /VOYGwnaMNDqqASV9VHmPy0k0QKsqc/xD/XCTryz4uzsZX3lWL29S8L9AejEsiMpinpy9 7sr9uBMvayYX8aRsW8SMLpn4T2lmyuZm9KjsiXGnMcBvMu122jDt2YI/wjDR5toY/Bphk U4haV+GdNUWfackDvLXyPiKOY9Qka7n0D+vkzH4lfcmY52yiN41qmbqEV6HpqiP6qSA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796336063; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject: Date:Message-ID:X-Mailer:MIME-Version:Content-Transfer-Encoding; bh=y5OT52i3oN+7C8t3Mna7+iOqhtpTtkVaoz9fJ4s0PWQ=; b=iRaPCwm98F2iBa1T/2dQrL3ykJgBEi6zmnz0bkrYU4bivVCZsOgnwBQHI/h3UpfM7r8I K7TQ1a9PGR5VPXEuIF2OOkSy4ZHJbQdlPLpJXVxxdMODVuDUYgyKdCo7JtN3r0mAqomtp dSt8jjnPqcQNwQHLXu5VnvLmUc5H5JlBnh2fUODVZAl7Kmyu5NJmkP4t3kgHEGcEAFsnX 25n84UlrkUQtFVX2j66p7ukr1eZgptAKSiRc8C9doP91LdQSXvPRv89pL9njhypr+8pcW +E97z0Bl/Vu0rmuisu3DpFnrv1/YH8zlQLrV/Ipc/t/6fYBfakbG+KF4lGQuqbn6B7g== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=dXuIevMM; arc=none smtp.remote-ip=209.85.128.53 Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C6EFB606A322 for ; Thu, 3 Dec 2026 22:14:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C6EFB606A322 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=dXuIevMM Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-4bb67b3a18aso173285e9.3 for ; Thu, 03 Dec 2026 14:14:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796336061; x=1796940861; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=y5OT52i3oN+7C8t3Mna7+iOqhtpTtkVaoz9fJ4s0PWQ=; b=dXuIevMMwMQHOa7viPi+uMXaXKk+6bTntTxXrG2rsMxC7UMWypTlORavnBPkxPzj/u XOd9f45iIOvKYu6L0q0KUagf2b1ph9C2oadSF7g2dZ5mUO1qM+0BLkapKh7JLM0IAw98 hLQvI44kac39ilkN+YvdcYNeOM3z4DwaQf+gxM2akAH7RC7XkJywRCQK1hSiZSuOWKB5 pBjx1lNDXZrlJ8uDCFMi2Z/kuG+xDE4zRVigkCY2/84qsJkdHs3EVJe6Iz7S7zYT3oux iNBgD66KFzg/As+C9ECsgu39rFgcqonrpYRODhms/9NmeLO6Xc+0ysC9vDNBNFXkEIS9 AhBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796336061; x=1796940861; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=y5OT52i3oN+7C8t3Mna7+iOqhtpTtkVaoz9fJ4s0PWQ=; b=RX3qbEM0z2Q2v4TXwz6TvOcaGDoeFHSzCtO/6XYJc90oq5yslX2OTipQE4SVpytB0l euXXPdQw9OMD8w+mfhFwuXOHZGTi9kAZSxluZvSGR6Atgahu+4oyKK0odM4d43L+MjDc Bv512iwV7pUSlEPaLmY83Zm7FFFh+tO57dqdhiXMZNnrDOn+X0H4snJ1LYIgr54D8phn ekzXlzBN8iUjZ7GH64uPG416A70FUCS86nLidNOpL5G+d7yxyNjCVfSkNNmvMcWnZqkV 0fmmiwvp9LxMdbj00PFJxLx981jxPrJN8PsKINsSE9PVUz8tOOOyRVKor+9SCrWIOUJB dnuw== X-Gm-Message-State: APuU4Z/PZluyqKyy1nc/G6nZeaBOvYUMJnjehXPvZSXfSjPzPLNVA33l zhACG+19X/Fy+03+VTa1HROl7FWuCDBTBHgCHqwd9PPVRXC0pymoBz8pHYKmSati X-Gm-Gg: AZFdTZfN+AFiDTcEJoDNz9e1+q0O5j50GaHCEzuJwbWIUT2D6voKdVFepC8W3bpUUrx RHzMQZ0486/lhn4Z++CD99+BEaaYBIMGadKrVlkxI0b4hrokFKpaBBzjYOJdMFHl2QilEOmpZML ttv3+g+F7cL9r+7P8jIf5A6sdHeUXX/2zFJJ72fQyX7f6TREStMsn3uWjvMaUpoLPs65p7rMSak Jvpml6HGeSqkpvFHdHK46DFGBfim6jsVMtu5vJpjnDe58Qhq14U7uzaYGYxiaCk+UI+N4QL6brc 9+oflR1IOMwb2eU/ybxWuGPeH1B2kYiwCO7zq9YEvgUvYxVxQv3WNLY7kBEu+MjMUWj/f85OE7x WLU/mwJ8+CJfSCYLjtpWA7EvJQHEDHWfNKH6NJF0CqcY1jvqvSiTH0Zeqm+B+CCxVWA75WiVCQo dT01rougvTkud+0yqMku+o+P1a+Tm9F8/tqnhnt+z2L8no6gMUYHYgNEmHbA0ngO3Y+rZGaDo1J 2dQoh1fT51lM7KTNzpJwI6k3fxUOerwPU4/gkJx9V9f4RCyJ82GOt18g7i0faGRQ1NRv9Sm9Mq0 YubLowrY9y5+VrExUBYj1j65q5SoeTYIVZtfYLjLOJunqUgT2Q== X-Received: by 2002:a05:600c:5806:b0:4bb:b39d:d447 with SMTP id 5b1f17b1804b1-4bbeb83d0e6mr475585e9.1.1796336060882; Thu, 03 Dec 2026 14:14:20 -0800 (PST) Received: from schinder.fritz.box ([2001:9e8:b39a:7900:a13b:fe74:8c9c:c788]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bbe00df154sm117266225e9.14.2026.12.03.14.14.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2026 14:14:20 -0800 (PST) From: Roland Schober To: linux-bluetooth@vger.kernel.org Cc: luiz.dentz@gmail.com, Roland Schober Subject: [RFC PATCH v2 0/6] Bluetooth: Periodic advertising and PAwR over MGMT Date: Thu, 3 Dec 2026 23:13:59 +0100 Message-ID: <20261203221405.682222-1-rolandschober1968@gmail.com> X-Mailer: git-send-email 2.47.3 X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Hi Luiz, v2 of the RFC for periodic advertising and the advertiser side of Periodic Advertising with Responses (PAwR) over MGMT. The interface is the one of v1, and the questions on it are still open; v2 fixes one more case in the kernel, which the review of the BlueZ series brought up, and is rebased onto bluetooth-next. Changes in v2: - New patch 3: an instance with a timeout and periodic advertising. When the timeout ends the controller stops the advertising of the set, and the kernel freed its instance. The periodic advertising went on in the controller, and nothing stopped it any more. The kernel now disables it and removes the set. - Patch 2 is the fix I sent on its own after v1 ("Bluetooth: hci_sync: Disable PA before removing an advertising set"), with that commit message. The code is the one of v1. - Rebased onto bluetooth-next. Patches 1 and 4 to 6 are unchanged. v1: "[RFC PATCH 0/5] Bluetooth: Periodic advertising and PAwR over MGMT" The interface (patches 4 to 6): Add Periodic Advertising Parameters (0x005d) Makes an instance created with Add Extended Advertising Parameters periodic, before Add Extended Advertising Data enables it. With a number of subevents it is PAwR, without it is plain periodic advertising. Add Periodic Advertising Data (0x005e) The data of a plain periodic advertising train. Periodic Advertising Subevent Data Request event (0x0035) The controller asks for the data of a range of subevents. Set Periodic Advertising Subevent Data (0x005f) The answer: the data of one or more subevents, in one HCI command. Periodic Advertising Response Report event (0x0036) The responses received in the response slots of a subevent. The parameters and the entries are those of the HCI commands and events, in their units; the advertising handle is replaced by the instance. Questions: 1. New commands, or flags and parameters added to Add Extended Advertising Parameters and Add Extended Advertising Data? I chose commands of their own because the existing ones have no room for the parameters, and an instance can then become periodic without a second way to create it. 2. Set Periodic Advertising Subevent Data is sent with hci_send_cmd() and answered from the Command Complete handler, as the PIN code and user confirmation replies are. Queued with hci_cmd_sync_queue() it waited behind the connection setup, and the controller refused the data as too late: it wants the data within its lead time, 40 to 50 ms on the controller I tested with. Is this acceptable, or is there a better way to send a command which must not wait? 3. The kernel does not check that the subevents of the answer are the requested ones, and does not split an answer over several HCI commands; the controller refuses what is wrong, and user space gets the error. Should the kernel do more here? 4. The controller's Too Late error (0x46) reaches user space as the generic Failed. Is a MGMT status of its own wanted? 5. The two events go to all MGMT sockets. Should they go only to the socket which added the instance? 6. New in v2: an instance with a timeout which is periodic is removed as a whole when the timeout ends, train included (patch 3). The other way would be to refuse periodic advertising parameters for an instance with a timeout. Is removing it what you would expect? Not in this series: - periodic advertising data of more than one HCI command (252 octets); - Periodic Advertising Sync Transfer over MGMT (the tests send LE Periodic Advertising Set Info Transfer with HCI Cmd Sync); - connecting to a synchronised device through a subevent (LE Extended Create Connection [v2]); - the scanner side. A known gap: if the controller never answers LE Set Periodic Advertising Subevent Data, its MGMT command stays pending, and the answer to the next one is taken for it. The PIN code replies have the same weakness; I have not solved it here. Patches 2 and 3 are needed by the others but stand on their own. Patch 2: the controller refuses to remove an advertising set while periodic advertising is enabled on it. Patch 3 changes nothing for an instance without periodic advertising. Tested in two ways. With the BlueZ emulator: the BlueZ series (v3) adds the PAwR advertiser to btdev and 33 mgmt-tester cases for the three commands, among them a second instance, controllers without the features, Remove Advertising and Set Powered off with a train running, an instance whose timeout ends with a train running, and subevent data which is too early, too late or sent in two commands at once. mgmt-tester passes 562 of 562. Without patch 2 the removal and the power off cases fail, without patch 3 the timeout case. The other testers pass: iso 213, l2cap 152, sco 30, ioctl 28, mesh 10, smp 8, userchan 4. No KASAN or lockdep reports. With a real controller, in QEMU: the Nordic SoftDevice Controller on a simulated nRF52 (BabbleSim), with Zephyr's periodic_sync_rsp sample as the responder. Plain periodic advertising: the train starts, its data is set and changed while it runs, the instance is removed. PAwR: the train starts, the responder is connected and synchronised by PAST, 95 data requests in 8 s are all answered in time and the responses arrive. An instance with a timeout and a PAwR train: when the timeout ends the controller sends LE Advertising Set Terminated and goes on with the train. Without patch 3 the data requests continue, and Add Periodic Advertising Parameters for the instance fails with Busy when it is added again. With it the train is disabled, the set is removed, and the instance can be added again. An earlier state of the PAwR patches, ported to 6.6, runs the PAwR exchange on an i.MX93 board. The Bluetooth code builds with W=1 without warnings. I could not run sparse, a 32-bit build or an LLVM build here. The BlueZ side (doc/mgmt-protocol.rst, btmon decoding, btmgmt commands, emulator and tests) is posted as "[RFC PATCH BlueZ v3 00/12] Periodic advertising and PAwR over MGMT". Roland Schober (6): Bluetooth: hci: Add Periodic Advertising with Responses definitions Bluetooth: hci_sync: Disable PA before removing an advertising set Bluetooth: hci_event: Stop PA when an advertising set times out Bluetooth: MGMT: Add Add Periodic Advertising Parameters command Bluetooth: MGMT: Add Add Periodic Advertising Data command Bluetooth: MGMT: Add PAwR subevent data and response reports include/net/bluetooth/hci.h | 59 +++++ include/net/bluetooth/hci_core.h | 20 ++ include/net/bluetooth/hci_sync.h | 2 + include/net/bluetooth/mgmt.h | 89 +++++++ net/bluetooth/hci_event.c | 115 +++++++++- net/bluetooth/hci_sync.c | 104 ++++++++- net/bluetooth/mgmt.c | 382 +++++++++++++++++++++++++++++++ 7 files changed, 767 insertions(+), 4 deletions(-) base-commit: 738af1958d2e7205008ca818352199ae8e454509 -- 2.47.3