* [PATCH BlueZ v1 1/2] shared/ad: Add bt_ad_length
@ 2024-05-15 16:12 Luiz Augusto von Dentz
2024-05-15 16:12 ` [PATCH BlueZ v1 2/2] advertising: Detect when EA needs to be used Luiz Augusto von Dentz
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2024-05-15 16:12 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This adds bt_ad_length which can be used to return the current size of
the bt_ad data.
---
src/shared/ad.c | 11 ++++++++---
src/shared/ad.h | 2 ++
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/src/shared/ad.c b/src/shared/ad.c
index f3fb428e25c6..d08ce7af9b85 100644
--- a/src/shared/ad.c
+++ b/src/shared/ad.c
@@ -520,9 +520,14 @@ static size_t data_length(struct queue *queue)
return length;
}
-static size_t calculate_length(struct bt_ad *ad)
+size_t bt_ad_length(struct bt_ad *ad)
{
- size_t length = 0;
+ size_t length;
+
+ if (!ad)
+ return 0;
+
+ length = 0;
length += uuid_list_length(ad->service_uuids);
@@ -698,7 +703,7 @@ uint8_t *bt_ad_generate(struct bt_ad *ad, size_t *length)
if (!ad)
return NULL;
- *length = calculate_length(ad);
+ *length = bt_ad_length(ad);
if (*length > ad->max_len)
return NULL;
diff --git a/src/shared/ad.h b/src/shared/ad.h
index 11900706f9ed..90cc82de9d63 100644
--- a/src/shared/ad.h
+++ b/src/shared/ad.h
@@ -108,6 +108,8 @@ struct bt_ad *bt_ad_ref(struct bt_ad *ad);
void bt_ad_unref(struct bt_ad *ad);
+size_t bt_ad_length(struct bt_ad *ad);
+
uint8_t *bt_ad_generate(struct bt_ad *ad, size_t *length);
bool bt_ad_is_empty(struct bt_ad *ad);
--
2.45.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH BlueZ v1 2/2] advertising: Detect when EA needs to be used
2024-05-15 16:12 [PATCH BlueZ v1 1/2] shared/ad: Add bt_ad_length Luiz Augusto von Dentz
@ 2024-05-15 16:12 ` Luiz Augusto von Dentz
2024-05-15 17:40 ` [PATCH BlueZ v1 1/2] shared/ad: Add bt_ad_length patchwork-bot+bluetooth
2024-05-15 18:07 ` [BlueZ,v1,1/2] " bluez.test.bot
2 siblings, 0 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2024-05-15 16:12 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This attempts to detect when an advertising instance needs to set the
secondary PHY in order to force EA PDUs to be used because its data is
too big for legacy PDUs.
---
src/advertising.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/advertising.c b/src/advertising.c
index b9d923d5d2c0..5d373e0884b1 100644
--- a/src/advertising.c
+++ b/src/advertising.c
@@ -884,6 +884,13 @@ static int get_adv_flags(struct btd_adv_client *client)
flags |= client->flags;
+ /* Detect if the length is bigger that legacy and secondary is not set
+ * then force it to be set to ensure the kernel uses EA.
+ */
+ if (bt_ad_length(client->data) > BT_AD_MAX_DATA_LEN &&
+ !(flags & MGMT_ADV_FLAG_SEC_MASK))
+ flags |= MGMT_ADV_FLAG_SEC_1M;
+
return flags;
}
--
2.45.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH BlueZ v1 1/2] shared/ad: Add bt_ad_length
2024-05-15 16:12 [PATCH BlueZ v1 1/2] shared/ad: Add bt_ad_length Luiz Augusto von Dentz
2024-05-15 16:12 ` [PATCH BlueZ v1 2/2] advertising: Detect when EA needs to be used Luiz Augusto von Dentz
@ 2024-05-15 17:40 ` patchwork-bot+bluetooth
2024-05-15 18:07 ` [BlueZ,v1,1/2] " bluez.test.bot
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+bluetooth @ 2024-05-15 17: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 Wed, 15 May 2024 12:12:49 -0400 you wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
>
> This adds bt_ad_length which can be used to return the current size of
> the bt_ad data.
> ---
> src/shared/ad.c | 11 ++++++++---
> src/shared/ad.h | 2 ++
> 2 files changed, 10 insertions(+), 3 deletions(-)
Here is the summary with links:
- [BlueZ,v1,1/2] shared/ad: Add bt_ad_length
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=263d6f7da564
- [BlueZ,v1,2/2] advertising: Detect when EA needs to be used
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=ea242fbf8602
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* RE: [BlueZ,v1,1/2] shared/ad: Add bt_ad_length
2024-05-15 16:12 [PATCH BlueZ v1 1/2] shared/ad: Add bt_ad_length Luiz Augusto von Dentz
2024-05-15 16:12 ` [PATCH BlueZ v1 2/2] advertising: Detect when EA needs to be used Luiz Augusto von Dentz
2024-05-15 17:40 ` [PATCH BlueZ v1 1/2] shared/ad: Add bt_ad_length patchwork-bot+bluetooth
@ 2024-05-15 18:07 ` bluez.test.bot
2 siblings, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2024-05-15 18:07 UTC (permalink / raw)
To: linux-bluetooth, luiz.dentz
[-- Attachment #1: Type: text/plain, Size: 948 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=853469
---Test result---
Test Summary:
CheckPatch PASS 0.76 seconds
GitLint PASS 0.53 seconds
BuildEll PASS 26.76 seconds
BluezMake PASS 1686.82 seconds
MakeCheck PASS 12.91 seconds
MakeDistcheck PASS 178.64 seconds
CheckValgrind PASS 247.58 seconds
CheckSmatch PASS 350.63 seconds
bluezmakeextell PASS 118.55 seconds
IncrementalBuild PASS 2981.30 seconds
ScanBuild PASS 982.69 seconds
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-05-15 18:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-15 16:12 [PATCH BlueZ v1 1/2] shared/ad: Add bt_ad_length Luiz Augusto von Dentz
2024-05-15 16:12 ` [PATCH BlueZ v1 2/2] advertising: Detect when EA needs to be used Luiz Augusto von Dentz
2024-05-15 17:40 ` [PATCH BlueZ v1 1/2] shared/ad: Add bt_ad_length patchwork-bot+bluetooth
2024-05-15 18:07 ` [BlueZ,v1,1/2] " bluez.test.bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox