* [PATCH BlueZ v2] policy: Fix service retry counters reset
@ 2025-05-27 13:45 Remi Pommarel
2025-05-27 15:28 ` [BlueZ,v2] " bluez.test.bot
2025-05-27 21:20 ` [PATCH BlueZ v2] " patchwork-bot+bluetooth
0 siblings, 2 replies; 3+ messages in thread
From: Remi Pommarel @ 2025-05-27 13:45 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Remi Pommarel
Control and Target retries counter were reset when service state
goes from CONNECTED to DISCONNECTED, but usually an extra DISCONNECTING
state is reached before going to DISCONNECTED. This causes retry counter
to not being reset in this case, leading to service not being able to
initialize on next connection. Source, sink and HS retry counter were
only reset when limit was reached, moreover HS timer was not removed on
CONNECTED state.
Reset all service retry counter as soon as CONNECTED state is reached to
avoid that. Also remove hs timer to match other services.
---
Changes since v1:
- Reset all service retry counter on CONNECTED
- Remove hs_timer on CONNECTED
---
plugins/policy.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/plugins/policy.c b/plugins/policy.c
index 0e533ba1f..561e3c089 100644
--- a/plugins/policy.c
+++ b/plugins/policy.c
@@ -311,6 +311,7 @@ static void sink_cb(struct btd_service *service, btd_service_state_t old_state,
timeout_remove(data->sink_timer);
data->sink_timer = 0;
}
+ data->sink_retries = 0;
/* Try connecting HSP/HFP if it is not connected */
hs = btd_device_get_service(dev, HFP_HS_UUID);
@@ -375,6 +376,11 @@ static void hs_cb(struct btd_service *service, btd_service_state_t old_state,
case BTD_SERVICE_STATE_CONNECTING:
break;
case BTD_SERVICE_STATE_CONNECTED:
+ if (data->hs_timer > 0) {
+ timeout_remove(data->hs_timer);
+ data->hs_timer = 0;
+ }
+ data->hs_retries = 0;
/* Check if service initiate the connection then proceed
* immediately otherwise set timer
*/
@@ -489,6 +495,7 @@ static void source_cb(struct btd_service *service,
timeout_remove(data->source_timer);
data->source_timer = 0;
}
+ data->source_retries = 0;
/* Check if service initiate the connection then proceed
* immediatelly otherwise set timer
@@ -537,8 +544,6 @@ static void controller_cb(struct btd_service *service,
timeout_remove(data->ct_timer);
data->ct_timer = 0;
}
- } else if (old_state == BTD_SERVICE_STATE_CONNECTED) {
- data->ct_retries = 0;
}
break;
case BTD_SERVICE_STATE_CONNECTING:
@@ -548,6 +553,7 @@ static void controller_cb(struct btd_service *service,
timeout_remove(data->ct_timer);
data->ct_timer = 0;
}
+ data->ct_retries = 0;
break;
case BTD_SERVICE_STATE_DISCONNECTING:
break;
@@ -587,8 +593,6 @@ static void target_cb(struct btd_service *service,
timeout_remove(data->tg_timer);
data->tg_timer = 0;
}
- } else if (old_state == BTD_SERVICE_STATE_CONNECTED) {
- data->tg_retries = 0;
}
break;
case BTD_SERVICE_STATE_CONNECTING:
@@ -598,6 +602,7 @@ static void target_cb(struct btd_service *service,
timeout_remove(data->tg_timer);
data->tg_timer = 0;
}
+ data->tg_retries = 0;
break;
case BTD_SERVICE_STATE_DISCONNECTING:
break;
--
2.40.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: [BlueZ,v2] policy: Fix service retry counters reset
2025-05-27 13:45 [PATCH BlueZ v2] policy: Fix service retry counters reset Remi Pommarel
@ 2025-05-27 15:28 ` bluez.test.bot
2025-05-27 21:20 ` [PATCH BlueZ v2] " patchwork-bot+bluetooth
1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2025-05-27 15:28 UTC (permalink / raw)
To: linux-bluetooth, repk
[-- Attachment #1: Type: text/plain, Size: 1261 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=966680
---Test result---
Test Summary:
CheckPatch PENDING 0.24 seconds
GitLint PENDING 0.25 seconds
BuildEll PASS 20.09 seconds
BluezMake PASS 2671.38 seconds
MakeCheck PASS 19.82 seconds
MakeDistcheck PASS 197.54 seconds
CheckValgrind PASS 272.85 seconds
CheckSmatch PASS 301.32 seconds
bluezmakeextell PASS 126.57 seconds
IncrementalBuild PENDING 0.37 seconds
ScanBuild PASS 895.61 seconds
Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:
##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH BlueZ v2] policy: Fix service retry counters reset
2025-05-27 13:45 [PATCH BlueZ v2] policy: Fix service retry counters reset Remi Pommarel
2025-05-27 15:28 ` [BlueZ,v2] " bluez.test.bot
@ 2025-05-27 21:20 ` patchwork-bot+bluetooth
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+bluetooth @ 2025-05-27 21:20 UTC (permalink / raw)
To: Remi Pommarel; +Cc: linux-bluetooth
Hello:
This patch was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Tue, 27 May 2025 15:45:21 +0200 you wrote:
> Control and Target retries counter were reset when service state
> goes from CONNECTED to DISCONNECTED, but usually an extra DISCONNECTING
> state is reached before going to DISCONNECTED. This causes retry counter
> to not being reset in this case, leading to service not being able to
> initialize on next connection. Source, sink and HS retry counter were
> only reset when limit was reached, moreover HS timer was not removed on
> CONNECTED state.
>
> [...]
Here is the summary with links:
- [BlueZ,v2] policy: Fix service retry counters reset
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=2a552b93de8b
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] 3+ messages in thread
end of thread, other threads:[~2025-05-27 21:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-27 13:45 [PATCH BlueZ v2] policy: Fix service retry counters reset Remi Pommarel
2025-05-27 15:28 ` [BlueZ,v2] " bluez.test.bot
2025-05-27 21:20 ` [PATCH BlueZ v2] " 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