2024-05-15 16:13:09

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: [PATCH BlueZ v1 1/2] shared/ad: Add bt_ad_length

From: Luiz Augusto von Dentz <[email protected]>

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



2024-05-15 16:13:15

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: [PATCH BlueZ v1 2/2] advertising: Detect when EA needs to be used

From: Luiz Augusto von Dentz <[email protected]>

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


2024-05-15 17:40:41

by patchwork-bot+bluetooth

[permalink] [raw]
Subject: Re: [PATCH BlueZ v1 1/2] shared/ad: Add bt_ad_length

Hello:

This series was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <[email protected]>:

On Wed, 15 May 2024 12:12:49 -0400 you wrote:
> From: Luiz Augusto von Dentz <[email protected]>
>
> 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



2024-05-15 18:08:06

by bluez.test.bot

[permalink] [raw]
Subject: RE: [BlueZ,v1,1/2] shared/ad: Add bt_ad_length

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