linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ v1 1/2] sco-tester: Fix closing the socket
@ 2025-03-11 19:42 Luiz Augusto von Dentz
  2025-03-11 19:42 ` [PATCH BlueZ v1 2/2] btdev: Fix double lookup Luiz Augusto von Dentz
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2025-03-11 19:42 UTC (permalink / raw)
  To: linux-bluetooth

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

When writting data the socket shall not be closed until all the data
could be transmitted or the test times out.
---
 tools/sco-tester.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/sco-tester.c b/tools/sco-tester.c
index e6888348bfab..b88631d89034 100644
--- a/tools/sco-tester.c
+++ b/tools/sco-tester.c
@@ -821,6 +821,9 @@ static gboolean sco_connect_cb(GIOChannel *io, GIOCondition cond,
 					errno);
 			err = -errno;
 		}
+
+		/* Don't close the socket until all data is sent */
+		g_io_channel_set_close_on_unref(io, FALSE);
 	}
 
 	if (scodata->shutdown) {
-- 
2.48.1


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

* [PATCH BlueZ v1 2/2] btdev: Fix double lookup
  2025-03-11 19:42 [PATCH BlueZ v1 1/2] sco-tester: Fix closing the socket Luiz Augusto von Dentz
@ 2025-03-11 19:42 ` Luiz Augusto von Dentz
  2025-03-11 21:11 ` [BlueZ,v1,1/2] sco-tester: Fix closing the socket bluez.test.bot
  2025-03-12 14:40 ` [PATCH BlueZ v1 1/2] " patchwork-bot+bluetooth
  2 siblings, 0 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2025-03-11 19:42 UTC (permalink / raw)
  To: linux-bluetooth

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

This fixes the existing double lookup when calling
num_completed_packets but passing the conn->handle instead of passing
the conn pointer directly since num_completed_packets would then attempt
to do another lookup by handle to resolve the conn pointer again.
---
 emulator/btdev.c | 24 +++++++++---------------
 1 file changed, 9 insertions(+), 15 deletions(-)

diff --git a/emulator/btdev.c b/emulator/btdev.c
index 976c1125d66e..1b7b75c21399 100644
--- a/emulator/btdev.c
+++ b/emulator/btdev.c
@@ -7460,21 +7460,15 @@ void btdev_set_send_handler(struct btdev *btdev, btdev_send_func handler,
 	btdev->send_data = user_data;
 }
 
-static void num_completed_packets(struct btdev *btdev, uint16_t handle)
+static void num_completed_packets(struct btdev *btdev, struct btdev_conn *conn)
 {
-	struct btdev_conn *conn;
+	struct bt_hci_evt_num_completed_packets ncp;
 
-	conn = queue_find(btdev->conns, match_handle, UINT_TO_PTR(handle));
-	if (conn) {
-		struct bt_hci_evt_num_completed_packets ncp;
+	ncp.num_handles = 1;
+	ncp.handle = cpu_to_le16(conn->handle);
+	ncp.count = cpu_to_le16(1);
 
-		ncp.num_handles = 1;
-		ncp.handle = cpu_to_le16(handle);
-		ncp.count = cpu_to_le16(1);
-
-		send_event(btdev, BT_HCI_EVT_NUM_COMPLETED_PACKETS,
-							&ncp, sizeof(ncp));
-	}
+	send_event(btdev, BT_HCI_EVT_NUM_COMPLETED_PACKETS, &ncp, sizeof(ncp));
 }
 
 static const struct btdev_cmd *run_cmd(struct btdev *btdev,
@@ -7672,7 +7666,7 @@ static void send_acl(struct btdev *dev, const void *data, uint16_t len)
 	if (!conn)
 		return;
 
-	num_completed_packets(dev, conn->handle);
+	num_completed_packets(dev, conn);
 
 	/* ACL_START_NO_FLUSH is only allowed from host to controller.
 	 * From controller to host this should be converted to ACL_START.
@@ -7709,7 +7703,7 @@ static void send_sco(struct btdev *dev, const void *data, uint16_t len)
 		return;
 
 	if (dev->sco_flowctl)
-		num_completed_packets(dev, conn->handle);
+		num_completed_packets(dev, conn);
 
 	if (conn->link)
 		send_packet(conn->link->dev, iov, 2);
@@ -7734,7 +7728,7 @@ static void send_iso(struct btdev *dev, const void *data, uint16_t len)
 	if (!conn)
 		return;
 
-	num_completed_packets(dev, conn->handle);
+	num_completed_packets(dev, conn);
 
 	if (conn->link)
 		send_packet(conn->link->dev, iov, 2);
-- 
2.48.1


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

* RE: [BlueZ,v1,1/2] sco-tester: Fix closing the socket
  2025-03-11 19:42 [PATCH BlueZ v1 1/2] sco-tester: Fix closing the socket Luiz Augusto von Dentz
  2025-03-11 19:42 ` [PATCH BlueZ v1 2/2] btdev: Fix double lookup Luiz Augusto von Dentz
@ 2025-03-11 21:11 ` bluez.test.bot
  2025-03-12 14:40 ` [PATCH BlueZ v1 1/2] " patchwork-bot+bluetooth
  2 siblings, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2025-03-11 21:11 UTC (permalink / raw)
  To: linux-bluetooth, luiz.dentz

[-- Attachment #1: Type: text/plain, Size: 1595 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/project/bluetooth/list/?series=942846

---Test result---

Test Summary:
CheckPatch                    PENDING   0.18 seconds
GitLint                       PENDING   0.23 seconds
BuildEll                      PASS      20.37 seconds
BluezMake                     PASS      1467.50 seconds
MakeCheck                     PASS      13.22 seconds
MakeDistcheck                 PASS      157.13 seconds
CheckValgrind                 PASS      214.41 seconds
CheckSmatch                   WARNING   284.15 seconds
bluezmakeextell               PASS      97.80 seconds
IncrementalBuild              PENDING   0.33 seconds
ScanBuild                     PASS      867.64 seconds

Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:

##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:

##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:
tools/sco-tester.c: note: in included file:./lib/bluetooth.h:232:15: warning: array of flexible structures./lib/bluetooth.h:237:31: warning: array of flexible structuresemulator/btdev.c:451:29: warning: Variable length array is used.
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:



---
Regards,
Linux Bluetooth


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

* Re: [PATCH BlueZ v1 1/2] sco-tester: Fix closing the socket
  2025-03-11 19:42 [PATCH BlueZ v1 1/2] sco-tester: Fix closing the socket Luiz Augusto von Dentz
  2025-03-11 19:42 ` [PATCH BlueZ v1 2/2] btdev: Fix double lookup Luiz Augusto von Dentz
  2025-03-11 21:11 ` [BlueZ,v1,1/2] sco-tester: Fix closing the socket bluez.test.bot
@ 2025-03-12 14:40 ` patchwork-bot+bluetooth
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+bluetooth @ 2025-03-12 14:40 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth

Hello:

This series was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Tue, 11 Mar 2025 15:42:25 -0400 you wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> When writting data the socket shall not be closed until all the data
> could be transmitted or the test times out.
> ---
>  tools/sco-tester.c | 3 +++
>  1 file changed, 3 insertions(+)

Here is the summary with links:
  - [BlueZ,v1,1/2] sco-tester: Fix closing the socket
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=df891f0ff44e
  - [BlueZ,v1,2/2] btdev: Fix double lookup
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=adcd73901831

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2025-03-12 14:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-11 19:42 [PATCH BlueZ v1 1/2] sco-tester: Fix closing the socket Luiz Augusto von Dentz
2025-03-11 19:42 ` [PATCH BlueZ v1 2/2] btdev: Fix double lookup Luiz Augusto von Dentz
2025-03-11 21:11 ` [BlueZ,v1,1/2] sco-tester: Fix closing the socket bluez.test.bot
2025-03-12 14:40 ` [PATCH BlueZ v1 1/2] " patchwork-bot+bluetooth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).