* RE: l2test: Several ECFC channels and sends on demand
2026-11-27 12:27 [PATCH BlueZ 1/3] l2test: Size frames to the channel's current MTU Simon Mikuda
@ 2026-11-27 15:47 ` bluez.test.bot
2026-12-01 15:39 ` Luiz Augusto von Dentz
0 siblings, 1 reply; 7+ messages in thread
From: bluez.test.bot @ 2026-11-27 15:47 UTC (permalink / raw)
To: linux-bluetooth, simon.mikuda
[-- Attachment #1: Type: text/plain, Size: 858 bytes --]
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/series/1224446/
---Test result---
Test Summary:
CheckPatch PASS 1.10 seconds
GitLint PASS 0.76 seconds
BuildEll PASS 20.84 seconds
BluezMake PASS 299.06 seconds
CheckSmatch PASS 308.03 seconds
bluezmakeextell PASS 98.55 seconds
TestFunctional PASS 1187.18 seconds
IncrementalBuild PASS 297.36 seconds
ScanBuild PASS 1088.35 seconds
https://github.com/bluez/bluez/pull/2938
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: l2test: Several ECFC channels and sends on demand
2026-11-27 15:47 ` l2test: Several ECFC channels and sends on demand bluez.test.bot
@ 2026-12-01 15:39 ` Luiz Augusto von Dentz
0 siblings, 0 replies; 7+ messages in thread
From: Luiz Augusto von Dentz @ 2026-12-01 15:39 UTC (permalink / raw)
To: linux-bluetooth; +Cc: simon.mikuda
Hi Simon,
On Fri, Nov 27, 2026 at 10:47 AM <bluez.test.bot@gmail.com> wrote:
>
> This is automated email and please do not reply to this email!
>
> Dear submitter,
>
> Thank you for submitting the patches to the linux bluetooth mailing list.
> This is a CI test results with your patch series:
> PW Link:https://patchwork.kernel.org/series/1224446/
>
> ---Test result---
>
> Test Summary:
> CheckPatch PASS 1.10 seconds
> GitLint PASS 0.76 seconds
> BuildEll PASS 20.84 seconds
> BluezMake PASS 299.06 seconds
> CheckSmatch PASS 308.03 seconds
> bluezmakeextell PASS 98.55 seconds
> TestFunctional PASS 1187.18 seconds
> IncrementalBuild PASS 297.36 seconds
> ScanBuild PASS 1088.35 seconds
>
>
>
> https://github.com/bluez/bluez/pull/2938
>
> ---
> Regards,
> Linux Bluetooth
Copilot flagged a couple of problems:
https://github.com/bluez/bluez/pull/2938#pullrequestreview-6121120265
--
Luiz Augusto von Dentz
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH BlueZ v2 0/3] l2test: Several ECFC channels and sends on demand
@ 2026-12-01 19:52 Simon Mikuda
2026-12-01 19:52 ` [PATCH BlueZ v2 1/3] l2test: Size frames to the channel's current MTU Simon Mikuda
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Simon Mikuda @ 2026-12-01 19:52 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Simon Mikuda
These let l2test drive the PTS L2CAP/ECFC cases that need several
channels in one request, or data sent after the tester reconfigured the
channel, which a single l2test channel with a fixed frame size cannot.
Changes in v2:
- l2test -k: the group's other channels are kept and closed with it
(reconnect mode, a failed connect, the listener once the child has the
group); each accepted group runs the mode on its last channel; -k
takes 1 to 5
- l2test without -b: the send buffer grows with BT_SNDMTU instead of
capping frames at the size at connection time
Simon Mikuda (3):
l2test: Size frames to the channel's current MTU
l2test: Add -j to send a burst for each line on stdin
l2test: Add -k to open several enhanced credit based channels
tools/l2test.c | 141 ++++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 135 insertions(+), 6 deletions(-)
base-commit: eecfd959cf5ae9a24ee007975439747779804be1
--
2.43.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH BlueZ v2 1/3] l2test: Size frames to the channel's current MTU
2026-12-01 19:52 [PATCH BlueZ v2 0/3] l2test: Several ECFC channels and sends on demand Simon Mikuda
@ 2026-12-01 19:52 ` Simon Mikuda
2026-12-02 10:06 ` l2test: Several ECFC channels and sends on demand bluez.test.bot
2026-12-01 19:52 ` [PATCH BlueZ v2 2/3] l2test: Add -j to send a burst for each line on stdin Simon Mikuda
2026-12-01 19:52 ` [PATCH BlueZ v2 3/3] l2test: Add -k to open several enhanced credit based channels Simon Mikuda
2 siblings, 1 reply; 7+ messages in thread
From: Simon Mikuda @ 2026-12-01 19:52 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Simon Mikuda
Without -b, a frame was as large as the output MTU at connection time.
An enhanced credit based channel can be reconfigured to a larger MTU
later, so each frame is now as large as BT_SNDMTU says when it is sent.
Assisted-by: Claude:claude-opus-5-5
---
tools/l2test.c | 33 ++++++++++++++++++++++++++++++++-
1 file changed, 32 insertions(+), 1 deletion(-)
diff --git a/tools/l2test.c b/tools/l2test.c
index d7a52fe0d..ff89bd838 100644
--- a/tools/l2test.c
+++ b/tools/l2test.c
@@ -1059,8 +1059,36 @@ static void recv_mode(int sk)
}
}
+/* The channel's MTU now: the peer may have reconfigured it since connection
+ * (enhanced credit based mode). The buffer grows with it, filled like the
+ * rest of a frame.
+ */
+static int current_omtu(int sk)
+{
+ uint16_t mtu;
+ socklen_t len = sizeof(mtu);
+ unsigned char *b;
+
+ if (getsockopt(sk, SOL_BLUETOOTH, BT_SNDMTU, &mtu, &len) < 0 || !mtu)
+ return omtu;
+
+ if (mtu > buffer_size) {
+ b = realloc(buf, mtu);
+ if (!b)
+ return buffer_size;
+
+ memset(b + buffer_size, 0x7f, mtu - buffer_size);
+ buf = b;
+ buffer_size = mtu;
+ }
+
+ return mtu;
+}
+
static void do_send(int sk)
{
+ /* Without -b each frame is as large as the channel's MTU */
+ bool follow_mtu = data_size < 0;
uint32_t seq;
int i, fd, len, buflen, size, sent;
@@ -1096,7 +1124,7 @@ static void do_send(int sk)
close(fd);
return;
} else {
- for (i = 6; i < data_size; i++)
+ for (i = 6; i < buffer_size; i++)
buf[i] = 0x7f;
}
@@ -1105,6 +1133,9 @@ static void do_send(int sk)
seq = seq_start;
while ((num_frames == -1) || (num_frames-- > 0)) {
+ if (follow_mtu)
+ data_size = omtu = current_omtu(sk);
+
put_le32(seq, buf);
put_le16(data_size, buf + 4);
--
2.43.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH BlueZ v2 2/3] l2test: Add -j to send a burst for each line on stdin
2026-12-01 19:52 [PATCH BlueZ v2 0/3] l2test: Several ECFC channels and sends on demand Simon Mikuda
2026-12-01 19:52 ` [PATCH BlueZ v2 1/3] l2test: Size frames to the channel's current MTU Simon Mikuda
@ 2026-12-01 19:52 ` Simon Mikuda
2026-12-01 19:52 ` [PATCH BlueZ v2 3/3] l2test: Add -k to open several enhanced credit based channels Simon Mikuda
2 siblings, 0 replies; 7+ messages in thread
From: Simon Mikuda @ 2026-12-01 19:52 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Simon Mikuda
With -j, a sending mode waits for a line on stdin before each burst
and sends as many frames as the line says, or -N's when it has no
number. A tester can then ask for data when it is ready for it, for
example after it reconfigured the channel:
echo 2 | l2test -w -X ext-flowctl -V le_public -j
Assisted-by: Claude:claude-opus-5-5
---
tools/l2test.c | 27 +++++++++++++++++++++++++--
1 file changed, 25 insertions(+), 2 deletions(-)
diff --git a/tools/l2test.c b/tools/l2test.c
index ff89bd838..2738f4bb2 100644
--- a/tools/l2test.c
+++ b/tools/l2test.c
@@ -120,6 +120,7 @@ static int linger = 0;
static int reliable = 0;
static int timestamp = 0;
static int defer_setup = 0;
+static bool stdin_frames;
static int priority = -1;
static int rcvbuf = 0;
static int32_t phy = -1;
@@ -1090,7 +1091,7 @@ static void do_send(int sk)
/* Without -b each frame is as large as the channel's MTU */
bool follow_mtu = data_size < 0;
uint32_t seq;
- int i, fd, len, buflen, size, sent;
+ int i, fd, len, buflen, size, sent, burst;
syslog(LOG_INFO, "Sending ...");
@@ -1132,6 +1133,19 @@ static void do_send(int sk)
usleep(send_delay);
seq = seq_start;
+ burst = num_frames;
+
+next_burst:
+ /* With -j, a burst for each line: its number of frames, -N's without */
+ if (stdin_frames) {
+ char line[16];
+
+ if (!fgets(line, sizeof(line), stdin))
+ return;
+
+ num_frames = atoi(line) > 0 ? atoi(line) : burst;
+ }
+
while ((num_frames == -1) || (num_frames-- > 0)) {
if (follow_mtu)
data_size = omtu = current_omtu(sk);
@@ -1161,6 +1175,9 @@ static void do_send(int sk)
!(seq % (count + seq_start)))
usleep(send_delay);
}
+
+ if (stdin_frames)
+ goto next_burst;
}
static void send_mode(int sk)
@@ -1467,6 +1484,8 @@ static void usage(void)
printf("Options:\n"
"\t[-b bytes] [-i device] [-P psm] [-J cid]\n"
"\t[-I imtu] [-O omtu]\n"
+ "\t[-j] send -N frames for each line on stdin (or as many as\n"
+ "\t the line says)\n"
"\t[-L seconds] enable SO_LINGER\n"
"\t[-W seconds] enable deferred setup\n"
"\t 0: don't enable (default)\n"
@@ -1505,7 +1524,7 @@ int main(int argc, char *argv[])
bacpy(&bdaddr, BDADDR_ANY);
- while ((opt = getopt(argc, argv, "a:b:cde:f:g:i:mnpqrstuwxyz"
+ while ((opt = getopt(argc, argv, "a:b:cde:f:g:i:jmnpqrstuwxyz"
"AB:C:D:EF:GH:I:J:K:L:MN:O:P:Q:RSTUV:W:X:Y:Z:")) != EOF) {
switch (opt) {
case 'r':
@@ -1576,6 +1595,10 @@ int main(int argc, char *argv[])
data_size = atoi(optarg);
break;
+ case 'j':
+ stdin_frames = true;
+ break;
+
case 'i':
if (!strncasecmp(optarg, "hci", 3))
hci_devba(atoi(optarg + 3), &bdaddr);
--
2.43.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH BlueZ v2 3/3] l2test: Add -k to open several enhanced credit based channels
2026-12-01 19:52 [PATCH BlueZ v2 0/3] l2test: Several ECFC channels and sends on demand Simon Mikuda
2026-12-01 19:52 ` [PATCH BlueZ v2 1/3] l2test: Size frames to the channel's current MTU Simon Mikuda
2026-12-01 19:52 ` [PATCH BlueZ v2 2/3] l2test: Add -j to send a burst for each line on stdin Simon Mikuda
@ 2026-12-01 19:52 ` Simon Mikuda
2 siblings, 0 replies; 7+ messages in thread
From: Simon Mikuda @ 2026-12-01 19:52 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Simon Mikuda
With -k num, l2test connects num channels in one
L2CAP_ECRED_CONN_REQ, or accepts num channels on one listener. The
first ones are connected with deferred setup, so the kernel puts them
into the request of the last one. The mode runs on the last channel and
the others stay open while it does.
Separate l2test processes cannot do this: the kernel only bundles the
deferred channels of one process.
l2test -n -X ext-flowctl -V le_public -P 0x80 -k 2 <bdaddr>
Assisted-by: Claude:claude-opus-5-5
---
tools/l2test.c | 83 +++++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 79 insertions(+), 4 deletions(-)
diff --git a/tools/l2test.c b/tools/l2test.c
index 2738f4bb2..e44b4d68a 100644
--- a/tools/l2test.c
+++ b/tools/l2test.c
@@ -121,6 +121,13 @@ static int reliable = 0;
static int timestamp = 0;
static int defer_setup = 0;
static bool stdin_frames;
+
+/* An enhanced credit based connection request carries up to 5 channels */
+#define MAX_CHANS 5
+static int num_chans = 1;
+/* The other channels of the group the mode runs on, closed with it */
+static int group_sk[MAX_CHANS - 1];
+static int group_len;
static int priority = -1;
static int rcvbuf = 0;
static int32_t phy = -1;
@@ -530,7 +537,13 @@ static int print_info(int sk, struct l2cap_options *opts)
return 0;
}
-static int do_connect(char *svr)
+static void close_group(void)
+{
+ while (group_len > 0)
+ close(group_sk[--group_len]);
+}
+
+static int connect_chan(char *svr, bool defer)
{
struct sockaddr_l2 addr;
struct l2cap_options opts;
@@ -655,12 +668,29 @@ static int do_connect(char *svr)
else
goto error;
- if (connect(sk, (struct sockaddr *) &addr, sizeof(addr)) < 0 ) {
+ if (defer) {
+ opt = 1;
+ if (setsockopt(sk, SOL_BLUETOOTH, BT_DEFER_SETUP, &opt,
+ sizeof(opt)) < 0) {
+ syslog(LOG_ERR, "Can't enable deferred setup: %s (%d)",
+ strerror(errno), errno);
+ goto error;
+ }
+
+ /* Or connect() waits for a request that is not sent yet */
+ fcntl(sk, F_SETFL, fcntl(sk, F_GETFL) | O_NONBLOCK);
+ }
+
+ if (connect(sk, (struct sockaddr *) &addr, sizeof(addr)) < 0 &&
+ !(defer && errno == EINPROGRESS)) {
syslog(LOG_ERR, "Can't connect: %s (%d)",
strerror(errno), errno);
goto error;
}
+ if (defer)
+ return sk;
+
/* Get current options */
if (getopts(sk, &opts, true) < 0) {
syslog(LOG_ERR, "Can't get L2CAP options: %s (%d)",
@@ -681,6 +711,31 @@ error:
return -1;
}
+/* All but the last of -k channels are deferred: the kernel puts them into the
+ * connection request of the last one (enhanced credit based mode), and they
+ * stay open while its mode runs.
+ */
+static int do_connect(char *svr)
+{
+ int sk;
+
+ while (group_len < num_chans - 1) {
+ sk = connect_chan(svr, true);
+ if (sk < 0) {
+ close_group();
+ return -1;
+ }
+
+ group_sk[group_len++] = sk;
+ }
+
+ sk = connect_chan(svr, false);
+ if (sk < 0)
+ close_group();
+
+ return sk;
+}
+
static void do_listen(void (*handler)(int sk))
{
struct sockaddr_l2 addr;
@@ -807,9 +862,17 @@ static void do_listen(void (*handler)(int sk))
strerror(errno), errno);
goto error;
}
+
+ /* The first -k channels stay open, the mode runs on the last */
+ if (group_len < num_chans - 1) {
+ group_sk[group_len++] = nsk;
+ continue;
+ }
+
if (fork()) {
- /* Parent */
+ /* Parent: the child has the group now */
close(nsk);
+ close_group();
continue;
}
/* Child */
@@ -1222,6 +1285,7 @@ static void reconnect_mode(char *svr)
while (1) {
int sk = do_connect(svr);
close(sk);
+ close_group();
}
}
@@ -1486,6 +1550,8 @@ static void usage(void)
"\t[-I imtu] [-O omtu]\n"
"\t[-j] send -N frames for each line on stdin (or as many as\n"
"\t the line says)\n"
+ "\t[-k num] num channels (ext-flowctl): connected in one\n"
+ "\t request, or accepted; the mode runs on the last one\n"
"\t[-L seconds] enable SO_LINGER\n"
"\t[-W seconds] enable deferred setup\n"
"\t 0: don't enable (default)\n"
@@ -1524,7 +1590,7 @@ int main(int argc, char *argv[])
bacpy(&bdaddr, BDADDR_ANY);
- while ((opt = getopt(argc, argv, "a:b:cde:f:g:i:jmnpqrstuwxyz"
+ while ((opt = getopt(argc, argv, "a:b:cde:f:g:i:jk:mnpqrstuwxyz"
"AB:C:D:EF:GH:I:J:K:L:MN:O:P:Q:RSTUV:W:X:Y:Z:")) != EOF) {
switch (opt) {
case 'r':
@@ -1599,6 +1665,15 @@ int main(int argc, char *argv[])
stdin_frames = true;
break;
+ case 'k':
+ num_chans = atoi(optarg);
+ if (num_chans < 1 || num_chans > MAX_CHANS) {
+ fprintf(stderr, "-k takes 1 to %d channels\n",
+ MAX_CHANS);
+ exit(1);
+ }
+ break;
+
case 'i':
if (!strncasecmp(optarg, "hci", 3))
hci_devba(atoi(optarg + 3), &bdaddr);
--
2.43.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* RE: l2test: Several ECFC channels and sends on demand
2026-12-01 19:52 ` [PATCH BlueZ v2 1/3] l2test: Size frames to the channel's current MTU Simon Mikuda
@ 2026-12-02 10:06 ` bluez.test.bot
0 siblings, 0 replies; 7+ messages in thread
From: bluez.test.bot @ 2026-12-02 10:06 UTC (permalink / raw)
To: linux-bluetooth, simon.mikuda
[-- Attachment #1: Type: text/plain, Size: 857 bytes --]
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/series/1228584/
---Test result---
Test Summary:
CheckPatch PASS 1.41 seconds
GitLint PASS 0.96 seconds
BuildEll PASS 16.93 seconds
BluezMake PASS 232.94 seconds
CheckSmatch PASS 239.19 seconds
bluezmakeextell PASS 77.83 seconds
TestFunctional PASS 1013.45 seconds
IncrementalBuild PASS 241.57 seconds
ScanBuild PASS 859.33 seconds
https://github.com/bluez/bluez/pull/2954
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-12-02 10:06 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-01 19:52 [PATCH BlueZ v2 0/3] l2test: Several ECFC channels and sends on demand Simon Mikuda
2026-12-01 19:52 ` [PATCH BlueZ v2 1/3] l2test: Size frames to the channel's current MTU Simon Mikuda
2026-12-02 10:06 ` l2test: Several ECFC channels and sends on demand bluez.test.bot
2026-12-01 19:52 ` [PATCH BlueZ v2 2/3] l2test: Add -j to send a burst for each line on stdin Simon Mikuda
2026-12-01 19:52 ` [PATCH BlueZ v2 3/3] l2test: Add -k to open several enhanced credit based channels Simon Mikuda
-- strict thread matches above, loose matches on Subject: below --
2026-11-27 12:27 [PATCH BlueZ 1/3] l2test: Size frames to the channel's current MTU Simon Mikuda
2026-11-27 15:47 ` l2test: Several ECFC channels and sends on demand bluez.test.bot
2026-12-01 15:39 ` Luiz Augusto von Dentz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox