From: Roland Schober <rolandschober1968@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: luiz.dentz@gmail.com, marcel@holtmann.org,
Roland Schober <rolandschober1968@gmail.com>
Subject: [RFC PATCH 0/5] Bluetooth: Periodic advertising and PAwR over MGMT
Date: Fri, 27 Nov 2026 09:53:55 +0100 [thread overview]
Message-ID: <20261127085401.263615-1-rolandschober1968@gmail.com> (raw)
Hi Luiz,
a few weeks ago I asked on this list, from my work address, whether
Periodic Advertising with Responses (PAwR) is planned, for a gateway
which serves battery powered displays like an ESL access point. You
suggested to start with PA and PAwR in MGMT, then the D-Bus API, with
emulator support so that it can be tested automatically.
This is the first step: periodic advertising and the advertiser side
of PAwR over MGMT, with emulator support and mgmt-tester cases in the
BlueZ series. I send it as RFC to get your view on the interface
before I go on with the responder side of the emulator and the D-Bus
API.
The interface (patches 3 to 5):
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?
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.
Patch 2 is needed by the others but stands on its own: the controller
refuses to remove an advertising set while periodic advertising is
enabled on it.
Tested in two ways.
With the BlueZ emulator: the BlueZ series adds the PAwR advertiser to
btdev and 31 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, and subevent data which is
too early, too late or sent in two commands at once. mgmt-tester
passes 560 of 560. Without patch 2 the removal and the power off cases
fail. The other testers pass as before: iso 213, l2cap 144, 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,
90 data requests in 8 s are all answered in time and the responses
arrive. An earlier state of the PAwR patches, ported to 6.6, runs the
same 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 0/9] Periodic advertising and PAwR over MGMT".
Roland Schober (5):
Bluetooth: hci: Add Periodic Advertising with Responses definitions
Bluetooth: hci_sync: Disable periodic advertising before removing a
set
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 | 90 ++++++++
net/bluetooth/hci_sync.c | 104 ++++++++-
net/bluetooth/mgmt.c | 382 +++++++++++++++++++++++++++++++
7 files changed, 745 insertions(+), 1 deletion(-)
--
2.47.3
next reply other threads:[~2026-11-27 8:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 8:53 Roland Schober [this message]
2026-11-27 8:53 ` [RFC PATCH 1/5] Bluetooth: hci: Add Periodic Advertising with Responses definitions Roland Schober
2026-11-27 8:53 ` [RFC PATCH 2/5] Bluetooth: hci_sync: Disable periodic advertising before removing a set Roland Schober
2026-11-27 8:53 ` [RFC PATCH 3/5] Bluetooth: MGMT: Add Add Periodic Advertising Parameters command Roland Schober
2026-11-27 8:53 ` [RFC PATCH 4/5] Bluetooth: MGMT: Add Add Periodic Advertising Data command Roland Schober
2026-11-27 8:54 ` [RFC PATCH 5/5] Bluetooth: MGMT: Add PAwR subevent data and response reports Roland Schober
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=20261127085401.263615-1-rolandschober1968@gmail.com \
--to=rolandschober1968@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=luiz.dentz@gmail.com \
--cc=marcel@holtmann.org \
/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