From c601c1586397baa23a9eeb870d72176150bfd4b0 Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Mon, 5 Feb 2024 15:57:47 +0100 Subject: [PATCH] Bluetooth: Mesh: Remove extra rescheduling and ADV_FLAG_SCHEDULED in adv This commit removes extra rescheduling in the extended advertiser after the last advertising has been finished. This commit also removes the `ADV_FLAG_SCHEDULED` flag as not needed anymore. This extra rescheduling and the flag were needed to delay the next advertisement by 20ms. Now, when the delay is removed the advertiser can pick the next advertisement from the pool and push to the host right away. Signed-off-by: Pavel Vasilyev --- subsys/bluetooth/mesh/adv_ext.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/subsys/bluetooth/mesh/adv_ext.c b/subsys/bluetooth/mesh/adv_ext.c index 87869023b8d0..5e428283bf96 100644 --- a/subsys/bluetooth/mesh/adv_ext.c +++ b/subsys/bluetooth/mesh/adv_ext.c @@ -42,8 +42,6 @@ enum { ADV_FLAG_PROXY, /** The proxy has been start, but maybe pending. */ ADV_FLAG_PROXY_START, - /** The send-call has been scheduled. */ - ADV_FLAG_SCHEDULED, /** The send-call has been pending. */ ADV_FLAG_SCHEDULE_PENDING, /** Custom adv params have been set, we need to update the parameters on @@ -267,14 +265,8 @@ static void send_pending_adv(struct k_work *work) ext_adv->adv = NULL; } - - (void)schedule_send(ext_adv); - - return; } - atomic_clear_bit(ext_adv->flags, ADV_FLAG_SCHEDULED); - while ((adv = bt_mesh_adv_get_by_tag(ext_adv->tags, K_NO_WAIT))) { /* busy == 0 means this was canceled */ if (!adv->ctx.busy) { @@ -325,7 +317,7 @@ static bool schedule_send(struct bt_mesh_ext_adv *ext_adv) if (atomic_test_bit(ext_adv->flags, ADV_FLAG_ACTIVE)) { atomic_set_bit(ext_adv->flags, ADV_FLAG_SCHEDULE_PENDING); return false; - } else if (atomic_test_and_set_bit(ext_adv->flags, ADV_FLAG_SCHEDULED)) { + } else if (k_work_is_pending(&ext_adv->work)) { return false; }