* [PATCH BlueZ] l2cap-tester: ensure SO_SNDBUF is large enough for the writes
@ 2025-03-18 22:22 Pauli Virtanen
2025-03-18 23:32 ` [BlueZ] " bluez.test.bot
0 siblings, 1 reply; 2+ messages in thread
From: Pauli Virtanen @ 2025-03-18 22:22 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Pauli Virtanen
Since btdev runs from same thread and won't flush, SO_SNDBUF needs to
hold all data we are going to write. Fix spurious test failure
in "L2CAP LE Client - Write 32k Success".
---
tools/l2cap-tester.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/tools/l2cap-tester.c b/tools/l2cap-tester.c
index e56773d13..3b3ffb6a7 100644
--- a/tools/l2cap-tester.c
+++ b/tools/l2cap-tester.c
@@ -1451,8 +1451,9 @@ static void l2cap_write_data(struct test_data *data, GIOChannel *io,
const struct l2cap_data *l2data = data->test_data;
struct bthost *bthost;
ssize_t ret;
- int sk;
+ int sk, size;
unsigned int count;
+ socklen_t len = sizeof(size);
sk = g_io_channel_unix_get_fd(io);
@@ -1464,6 +1465,15 @@ static void l2cap_write_data(struct test_data *data, GIOChannel *io,
l2cap_tx_timestamping(data, io);
+ /* Socket buffer needs to hold what we send, btdev doesn't flush now */
+ ret = getsockopt(sk, SOL_SOCKET, SO_SNDBUF, &size, &len);
+ if (!ret) {
+ size += l2data->data_len * (l2data->repeat_send + 1);
+ ret = setsockopt(sk, SOL_SOCKET, SO_SNDBUF, &size, len);
+ }
+ if (ret)
+ tester_warn("Failed to set SO_SNDBUF = %d", size);
+
for (count = 0; count < l2data->repeat_send + 1; ++count) {
ret = l2cap_send(sk, l2data->write_data, l2data->data_len,
data->l2o.omtu);
--
2.48.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-03-18 23:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-18 22:22 [PATCH BlueZ] l2cap-tester: ensure SO_SNDBUF is large enough for the writes Pauli Virtanen
2025-03-18 23:32 ` [BlueZ] " bluez.test.bot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.