public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ 1/2] btdev: fix CIG ID on Set CIG Parameters error response
@ 2023-08-05 12:29 Pauli Virtanen
  2023-08-05 12:29 ` [PATCH BlueZ 2/2] iso-tester: test busy CIG error does not drop existing connections Pauli Virtanen
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Pauli Virtanen @ 2023-08-05 12:29 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Pauli Virtanen

Set CIG Parameters shall return correct CIG ID in Command_Complete also
when it errors.
---
 emulator/btdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/emulator/btdev.c b/emulator/btdev.c
index 38dcb189e..58414bd74 100644
--- a/emulator/btdev.c
+++ b/emulator/btdev.c
@@ -5872,6 +5872,8 @@ static int cmd_set_cig_params(struct btdev *dev, const void *data,
 
 	memset(&rsp, 0, sizeof(rsp));
 
+	rsp.params.cig_id = cmd->cig_id;
+
 	if (cmd->num_cis > ARRAY_SIZE(dev->le_cig[0].cis)) {
 		rsp.params.status = BT_HCI_ERR_MEM_CAPACITY_EXCEEDED;
 		goto done;
@@ -5942,7 +5944,6 @@ static int cmd_set_cig_params(struct btdev *dev, const void *data,
 	}
 
 	rsp.params.status = BT_HCI_ERR_SUCCESS;
-	rsp.params.cig_id = cmd->cig_id;
 
 	for (i = 0; i < cmd->num_cis; i++) {
 		rsp.params.num_handles++;
-- 
2.41.0


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

* [PATCH BlueZ 2/2] iso-tester: test busy CIG error does not drop existing connections
  2023-08-05 12:29 [PATCH BlueZ 1/2] btdev: fix CIG ID on Set CIG Parameters error response Pauli Virtanen
@ 2023-08-05 12:29 ` Pauli Virtanen
  2023-08-05 14:00 ` [BlueZ,1/2] btdev: fix CIG ID on Set CIG Parameters error response bluez.test.bot
  2023-08-08 22:00 ` [PATCH BlueZ 1/2] " patchwork-bot+bluetooth
  2 siblings, 0 replies; 4+ messages in thread
From: Pauli Virtanen @ 2023-08-05 12:29 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Pauli Virtanen

A second connection made with same CIG while the CIG is busy, shall not
disconnect the first already existing connection.

Add test for this:

ISO Connect2 Busy CIG 0x01 - Success/Invalid

This was the original intent of "ISO Connect2 CIG 0x01 -
Success/Invalid", but the busy check should not be made synchronously in
connect() (to maintain ordering with Remove CIG etc), but must be done
in hci_sync. So the test needs to check the error async and explictly
that the first conn is not dropped.
---
 tools/iso-tester.c | 85 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/tools/iso-tester.c b/tools/iso-tester.c
index 9b9716e06..5a8b1fe68 100644
--- a/tools/iso-tester.c
+++ b/tools/iso-tester.c
@@ -2402,6 +2402,87 @@ static void test_connect2_seq(const void *test_data)
 	setup_connect(data, 0, iso_connect2_seq_cb);
 }
 
+static gboolean test_connect2_busy_done(gpointer user_data)
+{
+	struct test_data *data = tester_get_data();
+
+	if (data->io_id[0] > 0) {
+		/* First connection still exists */
+		g_source_remove(data->io_id[0]);
+		data->io_id[0] = 0;
+		tester_test_passed();
+	} else {
+		tester_test_failed();
+	}
+
+	return FALSE;
+}
+
+static gboolean iso_connect_cb_busy_disc(GIOChannel *io, GIOCondition cond,
+							gpointer user_data)
+{
+	struct test_data *data = tester_get_data();
+
+	data->io_id[0] = 0;
+
+	tester_print("Disconnected 1");
+	tester_test_failed();
+	return FALSE;
+}
+
+static gboolean iso_connect_cb_busy_2(GIOChannel *io, GIOCondition cond,
+							gpointer user_data)
+{
+	struct test_data *data = tester_get_data();
+	int err, sk_err, sk;
+	socklen_t len;
+
+	data->io_id[1] = 0;
+
+	sk = g_io_channel_unix_get_fd(io);
+
+	len = sizeof(sk_err);
+
+	if (getsockopt(sk, SOL_SOCKET, SO_ERROR, &sk_err, &len) < 0)
+		err = -errno;
+	else
+		err = -sk_err;
+
+	tester_print("Connected 2: %d", err);
+
+	if (err == -EBUSY && data->io_id[0] > 0) {
+		/* Wait in case first connection still gets disconnected */
+		data->io_id[1] = g_timeout_add(250, test_connect2_busy_done,
+									data);
+	} else {
+		tester_test_failed();
+	}
+
+	return FALSE;
+}
+
+static gboolean iso_connect_cb_busy(GIOChannel *io, GIOCondition cond,
+							gpointer user_data)
+{
+	struct test_data *data = tester_get_data();
+
+	/* First connection shall not be disconnected */
+	data->io_id[0] = g_io_add_watch(io, G_IO_ERR | G_IO_HUP,
+						iso_connect_cb_busy_disc, data);
+
+	/* Second connect shall fail since CIG is now busy */
+	setup_connect(data, 1, iso_connect_cb_busy_2);
+
+	return iso_connect(io, cond, user_data);
+}
+
+static void test_connect2_busy(const void *test_data)
+{
+	struct test_data *data = tester_get_data();
+
+	setup_connect(data, 0, iso_connect_cb_busy);
+}
+
 static gboolean iso_connect_close_cb(GIOChannel *io, GIOCondition cond,
 							gpointer user_data)
 {
@@ -2678,6 +2759,10 @@ int main(int argc, char *argv[])
 							setup_powered,
 							test_connect2);
 
+	test_iso2("ISO Connect2 Busy CIG 0x01 - Success/Invalid",
+					&connect_1_16_2_1, setup_powered,
+					test_connect2_busy);
+
 	test_iso2("ISO Defer Connect2 CIG 0x01 - Success", &defer_1_16_2_1,
 							setup_powered,
 							test_connect2);
-- 
2.41.0


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

* RE: [BlueZ,1/2] btdev: fix CIG ID on Set CIG Parameters error response
  2023-08-05 12:29 [PATCH BlueZ 1/2] btdev: fix CIG ID on Set CIG Parameters error response Pauli Virtanen
  2023-08-05 12:29 ` [PATCH BlueZ 2/2] iso-tester: test busy CIG error does not drop existing connections Pauli Virtanen
@ 2023-08-05 14:00 ` bluez.test.bot
  2023-08-08 22:00 ` [PATCH BlueZ 1/2] " patchwork-bot+bluetooth
  2 siblings, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2023-08-05 14:00 UTC (permalink / raw)
  To: linux-bluetooth, pav

[-- Attachment #1: Type: text/plain, Size: 2122 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=773356

---Test result---

Test Summary:
CheckPatch                    FAIL      1.33 seconds
GitLint                       PASS      0.69 seconds
BuildEll                      PASS      27.37 seconds
BluezMake                     PASS      887.61 seconds
MakeCheck                     PASS      12.75 seconds
MakeDistcheck                 PASS      157.93 seconds
CheckValgrind                 PASS      259.09 seconds
CheckSmatch                   WARNING   347.36 seconds
bluezmakeextell               PASS      104.51 seconds
IncrementalBuild              PASS      1448.91 seconds
ScanBuild                     PASS      1077.92 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
[BlueZ,2/2] iso-tester: test busy CIG error does not drop existing connections
WARNING:TYPO_SPELLING: 'explictly' may be misspelled - perhaps 'explicitly'?
#97: 
in hci_sync. So the test needs to check the error async and explictly
                                                            ^^^^^^^^^

/github/workspace/src/src/13342572.patch total: 0 errors, 1 warnings, 97 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

/github/workspace/src/src/13342572.patch has style problems, please review.

NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.


##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:
emulator/btdev.c:420:29: warning: Variable length array is used.


---
Regards,
Linux Bluetooth


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

* Re: [PATCH BlueZ 1/2] btdev: fix CIG ID on Set CIG Parameters error response
  2023-08-05 12:29 [PATCH BlueZ 1/2] btdev: fix CIG ID on Set CIG Parameters error response Pauli Virtanen
  2023-08-05 12:29 ` [PATCH BlueZ 2/2] iso-tester: test busy CIG error does not drop existing connections Pauli Virtanen
  2023-08-05 14:00 ` [BlueZ,1/2] btdev: fix CIG ID on Set CIG Parameters error response bluez.test.bot
@ 2023-08-08 22:00 ` patchwork-bot+bluetooth
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+bluetooth @ 2023-08-08 22:00 UTC (permalink / raw)
  To: Pauli Virtanen; +Cc: linux-bluetooth

Hello:

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

On Sat,  5 Aug 2023 15:29:06 +0300 you wrote:
> Set CIG Parameters shall return correct CIG ID in Command_Complete also
> when it errors.
> ---
>  emulator/btdev.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Here is the summary with links:
  - [BlueZ,1/2] btdev: fix CIG ID on Set CIG Parameters error response
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=459b095c663c
  - [BlueZ,2/2] iso-tester: test busy CIG error does not drop existing connections
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=96de1c6eb9ff

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:[~2023-08-08 22:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-05 12:29 [PATCH BlueZ 1/2] btdev: fix CIG ID on Set CIG Parameters error response Pauli Virtanen
2023-08-05 12:29 ` [PATCH BlueZ 2/2] iso-tester: test busy CIG error does not drop existing connections Pauli Virtanen
2023-08-05 14:00 ` [BlueZ,1/2] btdev: fix CIG ID on Set CIG Parameters error response bluez.test.bot
2023-08-08 22:00 ` [PATCH BlueZ 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