* [PATCH 0/1] Bluetooth: ISO: Avoid creating child socket if PA sync is terminating
@ 2023-11-29 16:28 Iulia Tanasescu
0 siblings, 0 replies; 5+ messages in thread
From: Iulia Tanasescu @ 2023-11-29 16:28 UTC (permalink / raw)
To: linux-bluetooth
Cc: claudia.rosu, mihai-octavian.urzica, silviu.barbulescu,
vlad.pruteanu, andrei.istodorescu, luiz.dentz, Iulia Tanasescu
When a PA sync socket is closed, the associated hcon is also unlinked
and cleaned up. If there are no other hcons marked with the
HCI_CONN_PA_SYNC flag, HCI_OP_LE_PA_TERM_SYNC is sent to controller.
Between the time of the command and the moment PA sync is terminated
in controller, residual BIGInfo reports might continue to come.
This causes a new PA sync hcon to be added, and a new socket to be
notified to user space.
This commit fixs this by adding a flag on a Broadcast listening
socket to mark when the PA sync child has been closed.
This flag is checked when BIGInfo reports are indicated in
iso_connect_ind, to avoid recreating a hcon and socket if
residual reports arrive before PA sync is terminated.
Iulia Tanasescu (1):
Bluetooth: ISO: Avoid creating child socket if PA sync is terminating
net/bluetooth/iso.c | 51 ++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 48 insertions(+), 3 deletions(-)
base-commit: ab3d463ded5dfd81227fc998910c40913ce17616
--
2.39.2
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 0/1] Bluetooth: ISO: Avoid creating child socket if PA sync is terminating
@ 2023-12-05 16:11 Iulia Tanasescu
2023-12-05 16:11 ` [PATCH 1/1] " Iulia Tanasescu
2023-12-08 15:10 ` [PATCH 0/1] " patchwork-bot+bluetooth
0 siblings, 2 replies; 5+ messages in thread
From: Iulia Tanasescu @ 2023-12-05 16:11 UTC (permalink / raw)
To: linux-bluetooth
Cc: claudia.rosu, mihai-octavian.urzica, silviu.barbulescu,
vlad.pruteanu, andrei.istodorescu, luiz.dentz, Iulia Tanasescu
When a PA sync socket is closed, the associated hcon is also unlinked
and cleaned up. If there are no other hcons marked with the
HCI_CONN_PA_SYNC flag, HCI_OP_LE_PA_TERM_SYNC is sent to controller.
Between the time of the command and the moment PA sync is terminated
in controller, residual BIGInfo reports might continue to come.
This causes a new PA sync hcon to be added, and a new socket to be
notified to user space.
This commit fixs this by adding a flag on a Broadcast listening
socket to mark when the PA sync child has been closed.
This flag is checked when BIGInfo reports are indicated in
iso_connect_ind, to avoid recreating a hcon and socket if
residual reports arrive before PA sync is terminated.
Iulia Tanasescu (1):
Bluetooth: ISO: Avoid creating child socket if PA sync is terminating
net/bluetooth/iso.c | 51 ++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 48 insertions(+), 3 deletions(-)
base-commit: ab3d463ded5dfd81227fc998910c40913ce17616
--
2.39.2
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/1] Bluetooth: ISO: Avoid creating child socket if PA sync is terminating
2023-12-05 16:11 [PATCH 0/1] Bluetooth: ISO: Avoid creating child socket if PA sync is terminating Iulia Tanasescu
@ 2023-12-05 16:11 ` Iulia Tanasescu
2023-12-05 17:01 ` bluez.test.bot
2023-12-08 15:10 ` [PATCH 0/1] " patchwork-bot+bluetooth
1 sibling, 1 reply; 5+ messages in thread
From: Iulia Tanasescu @ 2023-12-05 16:11 UTC (permalink / raw)
To: linux-bluetooth
Cc: claudia.rosu, mihai-octavian.urzica, silviu.barbulescu,
vlad.pruteanu, andrei.istodorescu, luiz.dentz, Iulia Tanasescu
When a PA sync socket is closed, the associated hcon is also unlinked
and cleaned up. If there are no other hcons marked with the
HCI_CONN_PA_SYNC flag, HCI_OP_LE_PA_TERM_SYNC is sent to controller.
Between the time of the command and the moment PA sync is terminated
in controller, residual BIGInfo reports might continue to come.
This causes a new PA sync hcon to be added, and a new socket to be
notified to user space.
This commit fixs this by adding a flag on a Broadcast listening
socket to mark when the PA sync child has been closed.
This flag is checked when BIGInfo reports are indicated in
iso_connect_ind, to avoid recreating a hcon and socket if
residual reports arrive before PA sync is terminated.
Signed-off-by: Iulia Tanasescu <iulia.tanasescu@nxp.com>
---
net/bluetooth/iso.c | 51 ++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 48 insertions(+), 3 deletions(-)
diff --git a/net/bluetooth/iso.c b/net/bluetooth/iso.c
index e49f00e8a6a6..04f6572d35f1 100644
--- a/net/bluetooth/iso.c
+++ b/net/bluetooth/iso.c
@@ -54,6 +54,7 @@ static void iso_sock_kill(struct sock *sk);
enum {
BT_SK_BIG_SYNC,
BT_SK_PA_SYNC,
+ BT_SK_PA_SYNC_TERM,
};
struct iso_pinfo {
@@ -82,6 +83,11 @@ static bool iso_match_sid(struct sock *sk, void *data);
static bool iso_match_sync_handle(struct sock *sk, void *data);
static void iso_sock_disconn(struct sock *sk);
+typedef bool (*iso_sock_match_t)(struct sock *sk, void *data);
+
+static struct sock *iso_get_sock_listen(bdaddr_t *src, bdaddr_t *dst,
+ iso_sock_match_t match, void *data);
+
/* ---- ISO timers ---- */
#define ISO_CONN_TIMEOUT (HZ * 40)
#define ISO_DISCONN_TIMEOUT (HZ * 2)
@@ -190,10 +196,21 @@ static void iso_chan_del(struct sock *sk, int err)
sock_set_flag(sk, SOCK_ZAPPED);
}
+static bool iso_match_conn_sync_handle(struct sock *sk, void *data)
+{
+ struct hci_conn *hcon = data;
+
+ if (test_bit(BT_SK_PA_SYNC, &iso_pi(sk)->flags))
+ return false;
+
+ return hcon->sync_handle == iso_pi(sk)->sync_handle;
+}
+
static void iso_conn_del(struct hci_conn *hcon, int err)
{
struct iso_conn *conn = hcon->iso_data;
struct sock *sk;
+ struct sock *parent;
if (!conn)
return;
@@ -209,6 +226,25 @@ static void iso_conn_del(struct hci_conn *hcon, int err)
if (sk) {
lock_sock(sk);
+
+ /* While a PA sync hcon is in the process of closing,
+ * mark parent socket with a flag, so that any residual
+ * BIGInfo adv reports that arrive before PA sync is
+ * terminated are not processed anymore.
+ */
+ if (test_bit(BT_SK_PA_SYNC, &iso_pi(sk)->flags)) {
+ parent = iso_get_sock_listen(&hcon->src,
+ &hcon->dst,
+ iso_match_conn_sync_handle,
+ hcon);
+
+ if (parent) {
+ set_bit(BT_SK_PA_SYNC_TERM,
+ &iso_pi(parent)->flags);
+ sock_put(parent);
+ }
+ }
+
iso_sock_clear_timer(sk);
iso_chan_del(sk, err);
release_sock(sk);
@@ -545,8 +581,6 @@ static struct sock *__iso_get_sock_listen_by_sid(bdaddr_t *ba, bdaddr_t *bc,
return NULL;
}
-typedef bool (*iso_sock_match_t)(struct sock *sk, void *data);
-
/* Find socket listening:
* source bdaddr (Unicast)
* destination bdaddr (Broadcast only)
@@ -1888,9 +1922,20 @@ int iso_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 *flags)
/* Try to get PA sync listening socket, if it exists */
sk = iso_get_sock_listen(&hdev->bdaddr, bdaddr,
iso_match_pa_sync_flag, NULL);
- if (!sk)
+
+ if (!sk) {
sk = iso_get_sock_listen(&hdev->bdaddr, bdaddr,
iso_match_sync_handle, ev2);
+
+ /* If PA Sync is in process of terminating,
+ * do not handle any more BIGInfo adv reports.
+ */
+
+ if (sk && test_bit(BT_SK_PA_SYNC_TERM,
+ &iso_pi(sk)->flags))
+ return lm;
+ }
+
if (sk) {
int err;
--
2.39.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* RE: Bluetooth: ISO: Avoid creating child socket if PA sync is terminating
2023-12-05 16:11 ` [PATCH 1/1] " Iulia Tanasescu
@ 2023-12-05 17:01 ` bluez.test.bot
0 siblings, 0 replies; 5+ messages in thread
From: bluez.test.bot @ 2023-12-05 17:01 UTC (permalink / raw)
To: linux-bluetooth, iulia.tanasescu
[-- Attachment #1: Type: text/plain, Size: 1422 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=807082
---Test result---
Test Summary:
CheckPatch PASS 0.56 seconds
GitLint PASS 0.25 seconds
SubjectPrefix PASS 0.09 seconds
BuildKernel PASS 27.05 seconds
CheckAllWarning PASS 29.91 seconds
CheckSparse PASS 35.22 seconds
CheckSmatch PASS 99.28 seconds
BuildKernel32 PASS 26.59 seconds
TestRunnerSetup PASS 419.94 seconds
TestRunner_l2cap-tester PASS 22.85 seconds
TestRunner_iso-tester PASS 47.07 seconds
TestRunner_bnep-tester PASS 6.91 seconds
TestRunner_mgmt-tester PASS 163.41 seconds
TestRunner_rfcomm-tester PASS 10.87 seconds
TestRunner_sco-tester PASS 14.35 seconds
TestRunner_ioctl-tester PASS 13.59 seconds
TestRunner_mesh-tester PASS 8.93 seconds
TestRunner_smp-tester PASS 9.63 seconds
TestRunner_userchan-tester PASS 7.26 seconds
IncrementalBuild PASS 25.31 seconds
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 0/1] Bluetooth: ISO: Avoid creating child socket if PA sync is terminating
2023-12-05 16:11 [PATCH 0/1] Bluetooth: ISO: Avoid creating child socket if PA sync is terminating Iulia Tanasescu
2023-12-05 16:11 ` [PATCH 1/1] " Iulia Tanasescu
@ 2023-12-08 15:10 ` patchwork-bot+bluetooth
1 sibling, 0 replies; 5+ messages in thread
From: patchwork-bot+bluetooth @ 2023-12-08 15:10 UTC (permalink / raw)
To: Iulia Tanasescu
Cc: linux-bluetooth, claudia.rosu, mihai-octavian.urzica,
silviu.barbulescu, vlad.pruteanu, andrei.istodorescu, luiz.dentz
Hello:
This patch was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Tue, 5 Dec 2023 18:11:39 +0200 you wrote:
> When a PA sync socket is closed, the associated hcon is also unlinked
> and cleaned up. If there are no other hcons marked with the
> HCI_CONN_PA_SYNC flag, HCI_OP_LE_PA_TERM_SYNC is sent to controller.
>
> Between the time of the command and the moment PA sync is terminated
> in controller, residual BIGInfo reports might continue to come.
> This causes a new PA sync hcon to be added, and a new socket to be
> notified to user space.
>
> [...]
Here is the summary with links:
- [1/1] Bluetooth: ISO: Avoid creating child socket if PA sync is terminating
https://git.kernel.org/bluetooth/bluetooth-next/c/1581c2ec0214
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] 5+ messages in thread
end of thread, other threads:[~2023-12-08 15:10 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-05 16:11 [PATCH 0/1] Bluetooth: ISO: Avoid creating child socket if PA sync is terminating Iulia Tanasescu
2023-12-05 16:11 ` [PATCH 1/1] " Iulia Tanasescu
2023-12-05 17:01 ` bluez.test.bot
2023-12-08 15:10 ` [PATCH 0/1] " patchwork-bot+bluetooth
-- strict thread matches above, loose matches on Subject: below --
2023-11-29 16:28 Iulia Tanasescu
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).