Skip to content

Commit

Permalink
Bluetooth: Mesh: Remove extra rescheduling and ADV_FLAG_SCHEDULED in adv
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
PavelVPV committed Feb 6, 2024
1 parent 826d67a commit 582f914
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions subsys/bluetooth/mesh/adv_ext.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 582f914

Please sign in to comment.