host/mesh: update k_work API

Updated k_work API to new behaviour reflected in `glue`.

This is port of:
81b9ba3a9b2dd4d5bd3f0966eac9f8f6dad983e6
17831b045f5869b0e57e26caa0441f263d1a5ae6
6a097caa22c769855aba552b50371bafe05ee6b4
5506727bde18bb9afcf4f1b969cd2cc09d7e65f8
This commit is contained in:
Krzysztof Kopyściński
2021-11-10 06:24:00 +01:00
committed by Krzysztof Kopyściński
parent 135dd1b42e
commit 097aa7f9a1
20 changed files with 207 additions and 187 deletions
+12 -12
View File
@@ -49,8 +49,8 @@ struct font_info {
static struct os_dev *epd_dev;
static bool pressed;
static bool stats_view;
static struct k_delayed_work epd_work;
static struct k_delayed_work long_press_work;
static struct k_work_delayable epd_work;
static struct k_work_delayable long_press_work;
static struct {
int pin;
@@ -61,7 +61,7 @@ static struct {
{ .pin = RGB_LED_BLU, },
};
struct k_delayed_work led_timer;
struct k_work_delayable led_timer;
static size_t print_line(enum font_size font_size, int row, const char *text,
size_t len, bool center)
@@ -121,7 +121,7 @@ static size_t get_len(enum font_size font, const char *text)
void board_blink_leds(void)
{
k_delayed_work_submit(&led_timer, K_MSEC(100));
k_work_reschedule(&led_timer, K_MSEC(100));
}
void board_show_text(const char *text, bool center, int32_t duration)
@@ -151,7 +151,7 @@ void board_show_text(const char *text, bool center, int32_t duration)
cfb_framebuffer_finalize(epd_dev);
if (duration != K_FOREVER) {
k_delayed_work_submit(&epd_work, duration);
k_work_reschedule(&epd_work, duration);
}
}
@@ -381,11 +381,11 @@ static void button_interrupt(struct os_event *ev)
printk("Button %s\n", pressed ? "pressed" : "released");
if (pressed) {
k_delayed_work_submit(&long_press_work, LONG_PRESS_TIMEOUT);
k_work_reschedule(&long_press_work, LONG_PRESS_TIMEOUT);
return;
}
k_delayed_work_cancel(&long_press_work);
k_work_cancel_delayable(&long_press_work);
if (!mesh_is_initialized()) {
return;
@@ -441,7 +441,7 @@ static void led_timeout(struct ble_npl_event *work)
i = led_cntr++ % ARRAY_SIZE(leds);
hal_gpio_write(leds[i].pin, 0);
k_delayed_work_submit(&led_timer, K_MSEC(100));
k_work_reschedule(&led_timer, K_MSEC(100));
}
static int configure_leds(void)
@@ -452,7 +452,7 @@ static int configure_leds(void)
hal_gpio_init_out(leds[i].pin, 1);
}
k_delayed_work_init(&led_timer, led_timeout);
k_work_init_delayable(&led_timer, led_timeout);
return 0;
}
@@ -466,7 +466,7 @@ static int erase_storage(void)
void board_refresh_display(void)
{
k_delayed_work_submit(&epd_work, K_NO_WAIT);
k_work_reschedule(&epd_work, K_NO_WAIT);
}
int board_init(void)
@@ -494,8 +494,8 @@ int board_init(void)
return -EIO;
}
k_delayed_work_init(&epd_work, epd_update);
k_delayed_work_init(&long_press_work, long_press);
k_work_init_delayable(&epd_work, epd_update);
k_work_init_delayable(&long_press_work, long_press);
pressed = button_is_pressed();
if (pressed) {
+1 -1
View File
@@ -436,7 +436,7 @@ struct bt_mesh_model_pub {
int (*update)(struct bt_mesh_model *mod);
/** Publish Period Timer. Only for stack-internal use. */
struct k_delayed_work timer;
struct k_work_delayable timer;
};
/** Model callback functions. */
+9 -7
View File
@@ -329,22 +329,24 @@ int bt_le_adv_start(const struct ble_gap_adv_params *param,
const struct bt_data *sd, size_t sd_len);
int bt_le_adv_stop(bool proxy);
struct k_delayed_work {
struct k_work_delayable {
struct ble_npl_callout work;
};
void k_work_init(struct ble_npl_callout *work, ble_npl_event_fn handler);
void k_delayed_work_init(struct k_delayed_work *w, ble_npl_event_fn *f);
void k_delayed_work_cancel(struct k_delayed_work *w);
bool k_delayed_work_pending(struct k_delayed_work *w);
void k_delayed_work_submit(struct k_delayed_work *w, uint32_t ms);
void k_work_init_delayable(struct k_work_delayable *w, ble_npl_event_fn *f);
void k_work_cancel_delayable(struct k_work_delayable *w);
bool k_work_delayable_is_pending(struct k_work_delayable *w);
void k_work_reschedule(struct k_work_delayable *w, uint32_t ms);
int64_t k_uptime_get(void);
uint32_t k_uptime_get_32(void);
void k_sleep(int32_t duration);
void k_work_submit(struct ble_npl_callout *w);
void k_work_add_arg(struct ble_npl_callout *w, void *arg);
void k_delayed_work_add_arg(struct k_delayed_work *w, void *arg);
uint32_t k_delayed_work_remaining_get(struct k_delayed_work *w);
void k_work_add_arg_delayable(struct k_work_delayable *w, void *arg);
ble_npl_time_t k_work_delayable_remaining_get(struct k_work_delayable *w);
void k_work_schedule(struct k_work_delayable *w, uint32_t ms);
uint32_t k_ticks_to_ms_floor32(ble_npl_time_t ticks);
static inline void net_buf_simple_save(struct os_mbuf *buf,
struct net_buf_simple_state *state)
+1 -1
View File
@@ -65,7 +65,7 @@ struct bt_mesh_health_srv {
const struct bt_mesh_health_srv_cb *cb;
/* Attention Timer state */
struct k_delayed_work attn_timer;
struct k_work_delayable attn_timer;
};
int bt_mesh_fault_update(struct bt_mesh_elem *elem);
+6 -6
View File
@@ -148,7 +148,7 @@ static void publish_sent(int err, void *user_data)
if (delay) {
BT_DBG("Publishing next time in %dms", (int) delay);
k_delayed_work_submit(&mod->pub->timer, delay);
k_work_reschedule(&mod->pub->timer, delay);
}
}
@@ -228,7 +228,7 @@ static void mod_publish(struct ble_npl_event *work)
/* Continue with normal publication */
if (period_ms) {
k_delayed_work_submit(&pub->timer, period_ms);
k_work_reschedule(&pub->timer, period_ms);
}
}
@@ -301,8 +301,8 @@ static void mod_init(struct bt_mesh_model *mod, struct bt_mesh_elem *elem,
if (mod->pub) {
mod->pub->mod = mod;
k_delayed_work_init(&mod->pub->timer, mod_publish);
k_delayed_work_add_arg(&mod->pub->timer, mod->pub);
k_work_init_delayable(&mod->pub->timer, mod_publish);
k_work_add_arg_delayable(&mod->pub->timer, mod->pub);
}
for (i = 0; i < ARRAY_SIZE(mod->keys); i++) {
@@ -738,7 +738,7 @@ int bt_mesh_model_publish(struct bt_mesh_model *model)
if (pub->count) {
BT_WARN("Clearing publish retransmit timer");
k_delayed_work_cancel(&pub->timer);
k_work_cancel_delayable(&pub->timer);
}
net_buf_simple_init(sdu, 0);
@@ -1249,7 +1249,7 @@ static void commit_mod(struct bt_mesh_model *mod, struct bt_mesh_elem *elem,
if (ms > 0) {
BT_DBG("Starting publish timer (period %u ms)", ms);
k_delayed_work_submit(&mod->pub->timer, K_MSEC(ms));
k_work_reschedule(&mod->pub->timer, K_MSEC(ms));
}
}
+10 -10
View File
@@ -34,7 +34,7 @@
/* 1 transmission, 20ms interval */
#define PROV_XMIT BT_MESH_TRANSMIT(0, 20)
static struct k_delayed_work beacon_timer;
static struct k_work_delayable beacon_timer;
static int cache_check(struct bt_mesh_subnet *sub, void *beacon_data)
{
@@ -230,7 +230,7 @@ static void beacon_send(struct ble_npl_event *work)
{
/* Don't send anything if we have an active provisioning link */
if (IS_ENABLED(CONFIG_BT_MESH_PB_ADV) && bt_mesh_prov_active()) {
k_delayed_work_submit(&beacon_timer,
k_work_reschedule(&beacon_timer,
K_SECONDS(MYNEWT_VAL(BLE_MESH_UNPROV_BEACON_INT)));
return;
}
@@ -244,7 +244,7 @@ static void beacon_send(struct ble_npl_event *work)
/* Only resubmit if beaconing is still enabled */
if (bt_mesh_beacon_enabled() ||
atomic_test_bit(bt_mesh.flags, BT_MESH_IVU_INITIATOR)) {
k_delayed_work_submit(&beacon_timer,
k_work_reschedule(&beacon_timer,
PROVISIONED_INTERVAL);
}
@@ -253,7 +253,7 @@ static void beacon_send(struct ble_npl_event *work)
if (IS_ENABLED(BLE_MESH_PB_ADV)) {
unprovisioned_beacon_send();
k_delayed_work_submit(&beacon_timer,
k_work_reschedule(&beacon_timer,
K_SECONDS(MYNEWT_VAL(BLE_MESH_UNPROV_BEACON_INT)));
}
}
@@ -430,7 +430,7 @@ void bt_mesh_beacon_init(void)
bt_mesh_subnet_cb_list[1] = subnet_evt;
}
k_delayed_work_init(&beacon_timer, beacon_send);
k_work_init_delayable(&beacon_timer, beacon_send);
}
void bt_mesh_beacon_ivu_initiator(bool enable)
@@ -438,9 +438,9 @@ void bt_mesh_beacon_ivu_initiator(bool enable)
atomic_set_bit_to(bt_mesh.flags, BT_MESH_IVU_INITIATOR, enable);
if (enable) {
k_delayed_work_submit(&beacon_timer, K_NO_WAIT);
k_work_reschedule(&beacon_timer, K_NO_WAIT);
} else if (!bt_mesh_beacon_enabled()) {
k_delayed_work_cancel(&beacon_timer);
k_work_cancel_delayable(&beacon_timer);
}
}
@@ -455,18 +455,18 @@ static void subnet_beacon_enable(struct bt_mesh_subnet *sub)
void bt_mesh_beacon_enable(void)
{
if (!bt_mesh_is_provisioned()) {
k_delayed_work_submit(&beacon_timer, K_NO_WAIT);
k_work_reschedule(&beacon_timer, K_NO_WAIT);
return;
}
bt_mesh_subnet_foreach(subnet_beacon_enable);
k_delayed_work_submit(&beacon_timer, K_NO_WAIT);
k_work_reschedule(&beacon_timer, K_NO_WAIT);
}
void bt_mesh_beacon_disable(void)
{
if (!atomic_test_bit(bt_mesh.flags, BT_MESH_IVU_INITIATOR)) {
k_delayed_work_cancel(&beacon_timer);
k_work_cancel_delayable(&beacon_timer);
}
}
+5 -4
View File
@@ -200,7 +200,7 @@ static uint8_t _mod_pub_set(struct bt_mesh_model *model, uint16_t pub_addr,
model->pub->count = 0;
if (model->pub->update) {
k_delayed_work_cancel(&model->pub->timer);
k_work_cancel_delayable(&model->pub->timer);
}
if (IS_ENABLED(CONFIG_BT_SETTINGS) && store) {
@@ -238,9 +238,9 @@ static uint8_t _mod_pub_set(struct bt_mesh_model *model, uint16_t pub_addr,
BT_DBG("period %u ms", (unsigned) period_ms);
if (period_ms > 0) {
k_delayed_work_submit(&model->pub->timer, period_ms);
k_work_reschedule(&model->pub->timer, period_ms);
} else {
k_delayed_work_cancel(&model->pub->timer);
k_work_cancel_delayable(&model->pub->timer);
}
}
@@ -2128,7 +2128,8 @@ static void lpn_timeout_get(struct bt_mesh_model *model,
goto send_rsp;
}
timeout = k_delayed_work_remaining_get(&frnd->timer) / 100;
timeout = k_ticks_to_ms_floor32(
k_work_delayable_remaining_get(&frnd->timer)) / 100;
send_rsp:
net_buf_simple_add_le24(msg, timeout);
+11 -11
View File
@@ -151,7 +151,7 @@ static void friend_clear(struct bt_mesh_friend *frnd)
BT_DBG("LPN 0x%04x", frnd->lpn);
k_delayed_work_cancel(&frnd->timer);
k_work_cancel_delayable(&frnd->timer);
memset(frnd->cred, 0, sizeof(frnd->cred));
@@ -605,7 +605,7 @@ static void friend_recv_delay(struct bt_mesh_friend *frnd)
int32_t delay = recv_delay(frnd);
frnd->pending_req = 1;
k_delayed_work_submit(&frnd->timer, K_MSEC(delay));
k_work_reschedule(&frnd->timer, K_MSEC(delay));
BT_DBG("Waiting RecvDelay of %d ms", delay);
}
@@ -772,7 +772,7 @@ static void friend_clear_sent(int err, void *user_data)
{
struct bt_mesh_friend *frnd = user_data;
k_delayed_work_submit(&frnd->clear.timer,
k_work_reschedule(&frnd->clear.timer,
K_SECONDS(frnd->clear.repeat_sec));
frnd->clear.repeat_sec *= 2;
}
@@ -867,7 +867,7 @@ int bt_mesh_friend_clear_cfm(struct bt_mesh_net_rx *rx,
return 0;
}
k_delayed_work_cancel(&frnd->clear.timer);
k_work_cancel_delayable(&frnd->clear.timer);
frnd->clear.frnd = BT_MESH_ADDR_UNASSIGNED;
return 0;
@@ -1037,7 +1037,7 @@ init_friend:
}
delay = offer_delay(frnd, rx->ctx.recv_rssi, msg->criteria);
k_delayed_work_submit(&frnd->timer, K_MSEC(delay));
k_work_reschedule(&frnd->timer, K_MSEC(delay));
enqueue_offer(frnd, rx->ctx.recv_rssi);
@@ -1154,12 +1154,12 @@ static void buf_send_end(int err, void *user_data)
}
if (frnd->established) {
k_delayed_work_submit(&frnd->timer, frnd->poll_to);
k_work_reschedule(&frnd->timer, frnd->poll_to);
BT_DBG("Waiting %u ms for next poll",
(unsigned) frnd->poll_to);
} else {
/* Friend offer timeout is 1 second */
k_delayed_work_submit(&frnd->timer, K_SECONDS(1));
k_work_reschedule(&frnd->timer, K_SECONDS(1));
BT_DBG("Waiting for first poll");
}
}
@@ -1322,10 +1322,10 @@ int bt_mesh_friend_init(void)
net_buf_slist_init(&frnd->queue);
k_delayed_work_init(&frnd->timer, friend_timeout);
k_delayed_work_add_arg(&frnd->timer, frnd);
k_delayed_work_init(&frnd->clear.timer, clear_timeout);
k_delayed_work_add_arg(&frnd->clear.timer, frnd);
k_work_init_delayable(&frnd->timer, friend_timeout);
k_work_add_arg_delayable(&frnd->timer, frnd);
k_work_init_delayable(&frnd->clear.timer, clear_timeout);
k_work_add_arg_delayable(&frnd->clear.timer, frnd);
for (j = 0; j < ARRAY_SIZE(frnd->seg); j++) {
net_buf_slist_init(&frnd->seg[j].queue);
+28 -8
View File
@@ -399,7 +399,7 @@ k_work_init(struct ble_npl_callout *work, ble_npl_event_fn handler)
}
void
k_delayed_work_init(struct k_delayed_work *w, ble_npl_event_fn *f)
k_work_init_delayable(struct k_work_delayable *w, ble_npl_event_fn *f)
{
#ifndef MYNEWT
ble_npl_callout_init(&w->work, nimble_port_get_dflt_eventq(), f, NULL);
@@ -409,25 +409,39 @@ k_delayed_work_init(struct k_delayed_work *w, ble_npl_event_fn *f)
}
bool
k_delayed_work_pending(struct k_delayed_work *w)
k_work_delayable_is_pending(struct k_work_delayable *w)
{
return ble_npl_callout_is_active(&w->work);
}
void
k_delayed_work_cancel(struct k_delayed_work *w)
k_work_cancel_delayable(struct k_work_delayable *w)
{
ble_npl_callout_stop(&w->work);
}
void
k_delayed_work_submit(struct k_delayed_work *w, uint32_t ms)
k_work_schedule(struct k_work_delayable *w, uint32_t ms)
{
uint32_t ticks;
if (ble_npl_time_ms_to_ticks(ms, &ticks) != 0) {
assert(0);
}
ble_npl_callout_reset(&w->work, ticks);
}
void
k_work_reschedule(struct k_work_delayable *w, uint32_t ms)
{
uint32_t ticks;
if (ble_npl_time_ms_to_ticks(ms, &ticks) != 0) {
assert(0);
}
if (ms == 0) {
ble_npl_callout_stop(&w->work);
}
ble_npl_callout_reset(&w->work, ticks);
}
@@ -444,13 +458,13 @@ k_work_add_arg(struct ble_npl_callout *w, void *arg)
}
void
k_delayed_work_add_arg(struct k_delayed_work *w, void *arg)
k_work_add_arg_delayable(struct k_work_delayable *w, void *arg)
{
k_work_add_arg(&w->work, arg);
}
uint32_t
k_delayed_work_remaining_get (struct k_delayed_work *w)
ble_npl_time_t
k_work_delayable_remaining_get (struct k_work_delayable *w)
{
int sr;
ble_npl_time_t t;
@@ -461,7 +475,13 @@ k_delayed_work_remaining_get (struct k_delayed_work *w)
OS_EXIT_CRITICAL(sr);
return ble_npl_time_ticks_to_ms32(t);
return t;
}
uint32_t
k_ticks_to_ms_floor32(ble_npl_time_t ticks)
{
return ble_npl_time_ticks_to_ms32(ticks);
}
int64_t k_uptime_get(void)
+7 -15
View File
@@ -221,7 +221,8 @@ static void send_attention_status(struct bt_mesh_model *model,
struct bt_mesh_health_srv *srv = model->user_data;
uint8_t time;
time = k_delayed_work_remaining_get(&srv->attn_timer) / 1000;
time = k_ticks_to_ms_floor32(
k_work_delayable_remaining_get(&srv->attn_timer)) / 1000;
BT_DBG("%u second%s", time, (time == 1) ? "" : "s");
bt_mesh_model_msg_init(msg, OP_ATTENTION_STATUS);
@@ -400,8 +401,8 @@ static int health_srv_init(struct bt_mesh_model *model)
model->pub->update = health_pub_update;
k_delayed_work_init(&srv->attn_timer, attention_off);
k_delayed_work_add_arg(&srv->attn_timer, srv);
k_work_init_delayable(&srv->attn_timer, attention_off);
k_work_add_arg_delayable(&srv->attn_timer, srv);
srv->model = model;
@@ -433,17 +434,8 @@ void bt_mesh_attention(struct bt_mesh_model *model, uint8_t time)
srv = model->user_data;
}
if (time) {
if (srv->cb && srv->cb->attn_on) {
srv->cb->attn_on(model);
}
k_delayed_work_submit(&srv->attn_timer, time * 1000);
} else {
k_delayed_work_cancel(&srv->attn_timer);
if (srv->cb && srv->cb->attn_off) {
srv->cb->attn_off(model);
}
if ((time > 0) && srv->cb && srv->cb->attn_on) {
srv->cb->attn_on(model);
}
k_work_reschedule(&srv->attn_timer, K_SECONDS(time));
}
+30 -28
View File
@@ -31,8 +31,8 @@ struct bt_mesh_hb_cb hb_cb;
static struct bt_mesh_hb_pub pub;
static struct bt_mesh_hb_sub sub;
static struct k_delayed_work sub_timer;
static struct k_delayed_work pub_timer;
static struct k_work_delayable sub_timer;
static struct k_work_delayable pub_timer;
static int64_t sub_remaining(void)
{
@@ -40,13 +40,15 @@ static int64_t sub_remaining(void)
return 0U;
}
return k_delayed_work_remaining_get(&sub_timer) / MSEC_PER_SEC;
uint32_t rem_ms = k_ticks_to_ms_floor32(
k_work_delayable_remaining_get(&sub_timer));
return rem_ms / MSEC_PER_SEC;
}
static void hb_publish_end_cb(int err, void *cb_data)
{
if (pub.period && pub.count > 1) {
k_delayed_work_submit(&pub_timer, K_SECONDS(pub.period));
k_work_reschedule(&pub_timer, K_SECONDS(pub.period));
}
if (pub.count != 0xffff) {
@@ -148,6 +150,11 @@ static void hb_publish(struct ble_npl_event *work)
BT_DBG("hb_pub.count: %u", pub.count);
/* Fast exit if disabled or expired */
if (pub.period == 0U || pub.count == 0U) {
return;
}
sub = bt_mesh_subnet_get(pub.net_idx);
if (!sub) {
BT_ERR("No matching subnet for idx 0x%02x", pub.net_idx);
@@ -155,10 +162,6 @@ static void hb_publish(struct ble_npl_event *work)
return;
}
if (pub.count == 0U) {
return;
}
err = heartbeat_send(&publish_cb, NULL);
if (err) {
hb_publish_end_cb(err, NULL);
@@ -185,8 +188,8 @@ int bt_mesh_hb_recv(struct bt_mesh_net_rx *rx, struct os_mbuf *buf)
return 0;
}
if (!k_delayed_work_pending(&sub_timer)) {
BT_DBG("Heartbeat subscription period expired");
if (!k_work_delayable_is_pending(&sub_timer)) {
BT_DBG("Heartbeat subscription inactive");
return 0;
}
@@ -215,7 +218,7 @@ static void pub_disable(void)
pub.ttl = 0U;
pub.period = 0U;
k_delayed_work_cancel(&pub_timer);
k_work_cancel_delayable(&pub_timer);
}
uint8_t bt_mesh_hb_pub_set(struct bt_mesh_hb_pub *new_pub)
@@ -247,12 +250,11 @@ uint8_t bt_mesh_hb_pub_set(struct bt_mesh_hb_pub *new_pub)
/* The first Heartbeat message shall be published as soon as possible
* after the Heartbeat Publication Period state has been configured for
* periodic publishing.
*
* If the new configuration disables publishing this flushes
* the work item.
*/
if (pub.period && pub.count) {
k_delayed_work_submit(&pub_timer, K_NO_WAIT);
} else {
k_delayed_work_cancel(&pub_timer);
}
k_work_reschedule(&pub_timer, K_NO_WAIT);
if (IS_ENABLED(CONFIG_BT_SETTINGS)) {
bt_mesh_settings_store_schedule(
@@ -294,9 +296,7 @@ uint8_t bt_mesh_hb_sub_set(uint16_t src, uint16_t dst, uint32_t period)
sub.min_hops = 0U;
sub.max_hops = 0U;
sub.count = 0U;
sub.period = sub.period - sub_remaining();
k_delayed_work_cancel(&sub_timer);
notify_sub_end();
sub.period = 0U;
} else if (period) {
sub.src = src;
sub.dst = dst;
@@ -304,16 +304,18 @@ uint8_t bt_mesh_hb_sub_set(uint16_t src, uint16_t dst, uint32_t period)
sub.max_hops = 0U;
sub.count = 0U;
sub.period = period;
k_delayed_work_submit(&sub_timer, K_SECONDS(period));
} else {
/* Clearing the period should stop heartbeat subscription
* without clearing the parameters, so we can still read them.
*/
sub.period = sub.period - sub_remaining();
k_delayed_work_cancel(&sub_timer);
notify_sub_end();
sub.period = 0U;
}
/* Start the timer, which notifies immediately if the new
* configuration disables the subscription.
*/
k_work_reschedule(&sub_timer, K_SECONDS(sub.period));
return STATUS_SUCCESS;
}
@@ -344,28 +346,28 @@ void bt_mesh_hb_feature_changed(uint16_t features)
void bt_mesh_hb_init(void)
{
pub.net_idx = BT_MESH_KEY_UNUSED;
k_delayed_work_init(&pub_timer, hb_publish);
k_delayed_work_init(&sub_timer, sub_end);
k_work_init_delayable(&pub_timer, hb_publish);
k_work_init_delayable(&sub_timer, sub_end);
}
void bt_mesh_hb_start(void)
{
if (pub.count && pub.period) {
BT_DBG("Starting heartbeat publication");
k_delayed_work_submit(&pub_timer, K_NO_WAIT);
k_work_reschedule(&pub_timer, K_NO_WAIT);
}
}
void bt_mesh_hb_suspend(void)
{
k_delayed_work_cancel(&pub_timer);
(void)k_work_cancel_delayable(&pub_timer);
}
void bt_mesh_hb_resume(void)
{
if (pub.period && pub.count) {
BT_DBG("Starting heartbeat publication");
k_delayed_work_submit(&pub_timer, K_NO_WAIT);
k_work_reschedule(&pub_timer, K_NO_WAIT);
}
}
+16 -16
View File
@@ -182,7 +182,7 @@ static void friend_clear_sent(int err, void *user_data)
}
lpn_set_state(BT_MESH_LPN_CLEAR);
k_delayed_work_submit(&lpn->timer, FRIEND_REQ_TIMEOUT);
k_work_reschedule(&lpn->timer, FRIEND_REQ_TIMEOUT);
}
static const struct bt_mesh_send_cb clear_sent_cb = {
@@ -230,7 +230,7 @@ static void clear_friendship(bool force, bool disable)
bt_mesh_rx_reset();
lpn_set_state(BT_MESH_LPN_DISABLED);
k_delayed_work_cancel(&lpn->timer);
k_work_cancel_delayable(&lpn->timer);
if (lpn->clear_success) {
lpn->old_friend = BT_MESH_ADDR_UNASSIGNED;
@@ -267,7 +267,7 @@ static void clear_friendship(bool force, bool disable)
if (!disable) {
lpn_set_state(BT_MESH_LPN_DISABLED);
k_delayed_work_submit(&lpn->timer, FRIEND_REQ_RETRY_TIMEOUT);
k_work_reschedule(&lpn->timer, FRIEND_REQ_RETRY_TIMEOUT);
return;
}
@@ -285,10 +285,10 @@ static void friend_req_sent(uint16_t duration, int err, void *user_data)
lpn->adv_duration = duration;
if (IS_ENABLED(CONFIG_BT_MESH_LPN_ESTABLISHMENT)) {
k_delayed_work_submit(&lpn->timer, FRIEND_REQ_WAIT);
k_work_reschedule(&lpn->timer, FRIEND_REQ_WAIT);
lpn_set_state(BT_MESH_LPN_REQ_WAIT);
} else {
k_delayed_work_submit(&lpn->timer,
k_work_reschedule(&lpn->timer,
duration + FRIEND_REQ_TIMEOUT);
lpn_set_state(BT_MESH_LPN_WAIT_OFFER);
}
@@ -362,11 +362,11 @@ static void req_sent(uint16_t duration, int err, void *user_data)
/* We start scanning a bit early to elimitate risk of missing
* response data due to HCI and other latencies.
*/
k_delayed_work_submit(&lpn->timer,
k_work_reschedule(&lpn->timer,
LPN_RECV_DELAY - SCAN_LATENCY);
} else {
lpn_set_state(BT_MESH_LPN_WAIT_UPDATE);
k_delayed_work_submit(&lpn->timer,
k_work_reschedule(&lpn->timer,
LPN_RECV_DELAY + duration +
lpn->recv_win);
}
@@ -459,7 +459,7 @@ int bt_mesh_lpn_set(bool enable)
} else {
if (IS_ENABLED(CONFIG_BT_MESH_LPN_AUTO) &&
lpn->state == BT_MESH_LPN_TIMER) {
k_delayed_work_cancel(&lpn->timer);
k_work_cancel_delayable(&lpn->timer);
lpn_set_state(BT_MESH_LPN_DISABLED);
} else {
bt_mesh_lpn_disable(false);
@@ -484,7 +484,7 @@ static void friend_response_received(struct bt_mesh_lpn *lpn)
int32_t timeout = poll_timeout(lpn);
k_delayed_work_submit(&lpn->timer, K_MSEC(timeout));
k_work_reschedule(&lpn->timer, K_MSEC(timeout));
}
void bt_mesh_lpn_msg_received(struct bt_mesh_net_rx *rx)
@@ -493,7 +493,7 @@ void bt_mesh_lpn_msg_received(struct bt_mesh_net_rx *rx)
if (lpn->state == BT_MESH_LPN_TIMER) {
BT_DBG("Restarting establishment timer");
k_delayed_work_submit(&lpn->timer, LPN_AUTO_TIMEOUT);
k_work_reschedule(&lpn->timer, LPN_AUTO_TIMEOUT);
return;
}
@@ -754,7 +754,7 @@ static void update_timeout(struct bt_mesh_lpn *lpn)
BT_WARN("No response from Friend during ReceiveWindow");
bt_mesh_scan_disable();
lpn_set_state(BT_MESH_LPN_ESTABLISHED);
k_delayed_work_submit(&lpn->timer, POLL_RETRY_TIMEOUT);
k_work_reschedule(&lpn->timer, POLL_RETRY_TIMEOUT);
} else {
if (IS_ENABLED(CONFIG_BT_MESH_LPN_ESTABLISHMENT)) {
bt_mesh_scan_disable();
@@ -799,7 +799,7 @@ static void lpn_timeout(struct ble_npl_event *work)
break;
case BT_MESH_LPN_REQ_WAIT:
bt_mesh_scan_enable();
k_delayed_work_submit(&lpn->timer,
k_work_reschedule(&lpn->timer,
lpn->adv_duration + FRIEND_REQ_SCAN);
lpn_set_state(BT_MESH_LPN_WAIT_OFFER);
break;
@@ -811,7 +811,7 @@ static void lpn_timeout(struct ble_npl_event *work)
lpn->lpn_counter++;
lpn_set_state(BT_MESH_LPN_ENABLED);
lpn->sent_req = 0U;
k_delayed_work_submit(&lpn->timer, FRIEND_REQ_RETRY_TIMEOUT);
k_work_reschedule(&lpn->timer, FRIEND_REQ_RETRY_TIMEOUT);
break;
case BT_MESH_LPN_ESTABLISHED:
if (lpn->req_attempts < REQ_ATTEMPTS(lpn)) {
@@ -834,7 +834,7 @@ static void lpn_timeout(struct ble_npl_event *work)
clear_friendship(false, false);
break;
case BT_MESH_LPN_RECV_DELAY:
k_delayed_work_submit(&lpn->timer,
k_work_reschedule(&lpn->timer,
lpn->adv_duration + SCAN_LATENCY +
lpn->recv_win);
bt_mesh_scan_enable();
@@ -1067,7 +1067,7 @@ int bt_mesh_lpn_init(void)
BT_DBG("");
k_delayed_work_init(&lpn->timer, lpn_timeout);
k_work_init_delayable(&lpn->timer, lpn_timeout);
if (lpn->state == BT_MESH_LPN_ENABLED) {
if (IS_ENABLED(CONFIG_BT_MESH_LPN_ESTABLISHMENT)) {
@@ -1083,7 +1083,7 @@ int bt_mesh_lpn_init(void)
if (IS_ENABLED(CONFIG_BT_MESH_LPN_AUTO)) {
BT_DBG("Waiting %u ms for messages", LPN_AUTO_TIMEOUT);
lpn_set_state(BT_MESH_LPN_TIMER);
k_delayed_work_submit(&lpn->timer, LPN_AUTO_TIMEOUT);
k_work_reschedule(&lpn->timer, LPN_AUTO_TIMEOUT);
}
}
+3 -3
View File
@@ -174,7 +174,7 @@ void bt_mesh_reset(void)
memset(bt_mesh.flags, 0, sizeof(bt_mesh.flags));
k_delayed_work_cancel(&bt_mesh.ivu_timer);
k_work_cancel_delayable(&bt_mesh.ivu_timer);
bt_mesh_cfg_reset();
@@ -240,7 +240,7 @@ static void model_suspend(struct bt_mesh_model *mod, struct bt_mesh_elem *elem,
{
if (mod->pub && mod->pub->update) {
mod->pub->count = 0;
k_delayed_work_cancel(&mod->pub->timer);
k_work_cancel_delayable(&mod->pub->timer);
}
}
@@ -281,7 +281,7 @@ static void model_resume(struct bt_mesh_model *mod, struct bt_mesh_elem *elem,
int32_t period_ms = bt_mesh_model_pub_period_get(mod);
if (period_ms) {
k_delayed_work_submit(&mod->pub->timer, period_ms);
k_work_reschedule(&mod->pub->timer, period_ms);
}
}
}
+4 -4
View File
@@ -307,7 +307,7 @@ do_update:
bt_mesh.seq = 0;
}
k_delayed_work_submit(&bt_mesh.ivu_timer, BT_MESH_IVU_TIMEOUT);
k_work_reschedule(&bt_mesh.ivu_timer, BT_MESH_IVU_TIMEOUT);
/* Notify other modules */
if (IS_ENABLED(CONFIG_BT_MESH_FRIEND)) {
@@ -869,7 +869,7 @@ static void ivu_refresh(struct ble_npl_event *work)
store_iv(true);
}
k_delayed_work_submit(&bt_mesh.ivu_timer, BT_MESH_IVU_TIMEOUT);
k_work_reschedule(&bt_mesh.ivu_timer, BT_MESH_IVU_TIMEOUT);
return;
}
@@ -1035,7 +1035,7 @@ void bt_mesh_net_init(void)
SYSINIT_PANIC_ASSERT_MSG(rc == 0,
"Failed to register bt_mesh_seq conf");
k_delayed_work_init(&bt_mesh.ivu_timer, ivu_refresh);
k_work_init_delayable(&bt_mesh.ivu_timer, ivu_refresh);
k_work_init(&bt_mesh.local_work, bt_mesh_net_local);
net_buf_slist_init(&bt_mesh.local_queue);
@@ -1181,6 +1181,6 @@ void bt_mesh_net_clear(void)
void bt_mesh_net_settings_commit(void)
{
if (bt_mesh.ivu_duration < BT_MESH_IVU_MIN_HOURS) {
k_delayed_work_submit(&bt_mesh.ivu_timer, BT_MESH_IVU_TIMEOUT);
k_work_reschedule(&bt_mesh.ivu_timer, BT_MESH_IVU_TIMEOUT);
}
}
+4 -4
View File
@@ -74,7 +74,7 @@ struct bt_mesh_friend {
uint16_t sub_list[FRIEND_SUB_LIST_SIZE];
struct k_delayed_work timer;
struct k_work_delayable timer;
struct bt_mesh_friend_seg {
struct net_buf_slist_t queue;
@@ -96,7 +96,7 @@ struct bt_mesh_friend {
uint32_t start; /* Clear Procedure start */
uint16_t frnd; /* Previous Friend's address */
uint16_t repeat_sec; /* Repeat timeout in seconds */
struct k_delayed_work timer; /* Repeat timer */
struct k_work_delayable timer; /* Repeat timer */
} clear;
};
@@ -160,7 +160,7 @@ struct bt_mesh_lpn {
uint16_t adv_duration;
/* Next LPN related action timer */
struct k_delayed_work timer;
struct k_work_delayable timer;
/* Subscribed groups */
uint16_t groups[LPN_GROUPS];
@@ -221,7 +221,7 @@ struct bt_mesh_net {
uint8_t default_ttl;
/* Timer to track duration in current IV Update state */
struct k_delayed_work ivu_timer;
struct k_work_delayable ivu_timer;
uint8_t dev_key[16];
};
+10 -10
View File
@@ -105,11 +105,11 @@ struct pb_adv {
void *cb_data;
/* Retransmit timer */
struct k_delayed_work retransmit;
struct k_work_delayable retransmit;
} tx;
/* Protocol timeout */
struct k_delayed_work prot_timer;
struct k_work_delayable prot_timer;
};
struct prov_rx {
@@ -136,7 +136,7 @@ static void buf_sent(int err, void *user_data)
}
BT_DBG("submit retransmit");
k_delayed_work_submit(&link.tx.retransmit, RETRANSMIT_TIMEOUT);
k_work_reschedule(&link.tx.retransmit, RETRANSMIT_TIMEOUT);
}
static struct bt_mesh_send_cb buf_sent_cb = {
@@ -181,7 +181,7 @@ static void prov_clear_tx(void)
{
BT_DBG("");
k_delayed_work_cancel(&link.tx.retransmit);
k_work_cancel_delayable(&link.tx.retransmit);
free_segments();
}
@@ -191,7 +191,7 @@ static void reset_adv_link(void)
BT_DBG("");
prov_clear_tx();
k_delayed_work_cancel(&link.prot_timer);
k_work_cancel_delayable(&link.prot_timer);
if (atomic_test_bit(link.flags, ADV_PROVISIONER)) {
/* Clear everything except the retransmit and protocol timer
@@ -258,7 +258,7 @@ static void prov_failed(uint8_t err)
static void prov_msg_recv(void)
{
k_delayed_work_submit(&link.prot_timer, PROTOCOL_TIMEOUT);
k_work_reschedule(&link.prot_timer, PROTOCOL_TIMEOUT);
if (!bt_mesh_fcs_check(link.rx.buf, link.rx.fcs)) {
BT_ERR("Incorrect FCS");
@@ -624,7 +624,7 @@ static int bearer_ctl_send(uint8_t op, const void *data, uint8_t data_len,
BT_DBG("op 0x%02x data_len %u", op, data_len);
prov_clear_tx();
k_delayed_work_submit(&link.prot_timer, PROTOCOL_TIMEOUT);
k_work_reschedule(&link.prot_timer, PROTOCOL_TIMEOUT);
buf = adv_buf_create(reliable ? RETRANSMITS_RELIABLE :
RETRANSMITS_UNRELIABLE);
@@ -656,7 +656,7 @@ static int prov_send_adv(struct os_mbuf *msg,
uint8_t seg_len, seg_id;
prov_clear_tx();
k_delayed_work_submit(&link.prot_timer, PROTOCOL_TIMEOUT);
k_work_reschedule(&link.prot_timer, PROTOCOL_TIMEOUT);
start = adv_buf_create(RETRANSMITS_RELIABLE);
if (!start) {
@@ -864,8 +864,8 @@ static void prov_link_close(enum prov_bearer_link_status status)
void pb_adv_init(void)
{
k_delayed_work_init(&link.prot_timer, protocol_timeout);
k_delayed_work_init(&link.tx.retransmit, prov_retransmit);
k_work_init_delayable(&link.prot_timer, protocol_timeout);
k_work_init_delayable(&link.tx.retransmit, prov_retransmit);
if (!rx_buf) {
rx_buf = NET_BUF_SIMPLE(65);
+6 -6
View File
@@ -27,7 +27,7 @@ struct prov_link {
uint8_t fcs; /* Expected FCS value */
struct os_mbuf *buf;
} rx;
struct k_delayed_work prot_timer;
struct k_work_delayable prot_timer;
};
static struct prov_link link;
@@ -36,7 +36,7 @@ static void reset_state(void)
{
link.conn_handle = BLE_HS_CONN_HANDLE_NONE;
k_delayed_work_cancel(&link.prot_timer);
k_work_cancel_delayable(&link.prot_timer);
link.rx.buf = bt_mesh_proxy_get_buf();
}
@@ -73,7 +73,7 @@ int bt_mesh_pb_gatt_recv(uint16_t conn_handle, struct os_mbuf *buf)
return -EINVAL;
}
k_delayed_work_submit(&link.prot_timer, PROTOCOL_TIMEOUT);
k_work_reschedule(&link.prot_timer, PROTOCOL_TIMEOUT);
link.cb->recv(&pb_gatt, link.cb_data, buf);
@@ -89,7 +89,7 @@ int bt_mesh_pb_gatt_open(uint16_t conn_handle)
}
link.conn_handle = conn_handle;
k_delayed_work_submit(&link.prot_timer, PROTOCOL_TIMEOUT);
k_work_reschedule(&link.prot_timer, PROTOCOL_TIMEOUT);
link.cb->link_opened(&pb_gatt, link.cb_data);
@@ -131,7 +131,7 @@ static int buf_send(struct os_mbuf *buf, prov_bearer_send_complete_t cb,
return -ENOTCONN;
}
k_delayed_work_submit(&link.prot_timer, PROTOCOL_TIMEOUT);
k_work_reschedule(&link.prot_timer, PROTOCOL_TIMEOUT);
return bt_mesh_proxy_send(link.conn_handle, BT_MESH_PROXY_PROV, buf);
}
@@ -143,7 +143,7 @@ static void clear_tx(void)
void pb_gatt_init(void)
{
k_delayed_work_init(&link.prot_timer, protocol_timeout);
k_work_init_delayable(&link.prot_timer, protocol_timeout);
}
void pb_gatt_reset(void)
+7 -7
View File
@@ -125,7 +125,7 @@ static struct bt_mesh_proxy_client {
#if (MYNEWT_VAL(BLE_MESH_GATT_PROXY))
struct ble_npl_callout send_beacons;
#endif
struct k_delayed_work sar_timer;
struct k_work_delayable sar_timer;
struct os_mbuf *buf;
} clients[MYNEWT_VAL(BLE_MAX_CONNECTIONS)] = {
[0 ... (MYNEWT_VAL(BLE_MAX_CONNECTIONS) - 1)] = { 0 },
@@ -568,7 +568,7 @@ static int proxy_recv(uint16_t conn_handle, uint16_t attr_handle,
return -EINVAL;
}
k_delayed_work_submit(&client->sar_timer, PROXY_SAR_TIMEOUT);
k_work_reschedule(&client->sar_timer, PROXY_SAR_TIMEOUT);
client->msg_type = PDU_TYPE(data);
net_buf_simple_add_mem(client->buf, data + 1, len - 1);
break;
@@ -584,7 +584,7 @@ static int proxy_recv(uint16_t conn_handle, uint16_t attr_handle,
return -EINVAL;
}
k_delayed_work_submit(&client->sar_timer, PROXY_SAR_TIMEOUT);
k_work_reschedule(&client->sar_timer, PROXY_SAR_TIMEOUT);
net_buf_simple_add_mem(client->buf, data + 1, len - 1);
break;
@@ -599,7 +599,7 @@ static int proxy_recv(uint16_t conn_handle, uint16_t attr_handle,
return -EINVAL;
}
k_delayed_work_cancel(&client->sar_timer);
k_work_cancel_delayable(&client->sar_timer);
net_buf_simple_add_mem(client->buf, data + 1, len - 1);
proxy_complete_pdu(client);
break;
@@ -661,7 +661,7 @@ static void proxy_disconnected(uint16_t conn_handle, int reason)
bt_mesh_pb_gatt_close(conn_handle);
}
k_delayed_work_cancel(&client->sar_timer);
k_work_cancel_delayable(&client->sar_timer);
client->conn_handle = BLE_HS_CONN_HANDLE_NONE;
break;
}
@@ -1543,8 +1543,8 @@ int bt_mesh_proxy_init(void)
clients[i].buf = NET_BUF_SIMPLE(CLIENT_BUF_SIZE);
clients[i].conn_handle = BLE_HS_CONN_HANDLE_NONE;
k_delayed_work_init(&clients[i].sar_timer, proxy_sar_timeout);
k_delayed_work_add_arg(&clients[i].sar_timer, &clients[i]);
k_work_init_delayable(&clients[i].sar_timer, proxy_sar_timeout);
k_work_add_arg_delayable(&clients[i].sar_timer, &clients[i]);
}
resolve_svc_handles();
+14 -11
View File
@@ -27,7 +27,7 @@
#include "config/config.h"
static struct k_delayed_work pending_store;
static struct k_work_delayable pending_store;
static ATOMIC_DEFINE(pending_flags, BT_MESH_SETTINGS_FLAG_COUNT);
int settings_name_next(char *name, char **next)
@@ -97,7 +97,7 @@ static int mesh_commit(void)
void bt_mesh_settings_store_schedule(enum bt_mesh_settings_flag flag)
{
int32_t timeout_ms, remaining;
int32_t timeout_ms, remaining_ms;
atomic_set_bit(pending_flags, flag);
@@ -113,15 +113,18 @@ void bt_mesh_settings_store_schedule(enum bt_mesh_settings_flag flag)
timeout_ms = CONFIG_BT_MESH_STORE_TIMEOUT * MSEC_PER_SEC;
}
remaining = k_delayed_work_remaining_get(&pending_store);
if ((remaining > 0) && remaining < timeout_ms) {
BT_DBG("Not rescheduling due to existing earlier deadline");
return;
remaining_ms = k_ticks_to_ms_floor32(
k_work_delayable_remaining_get(&pending_store));
BT_DBG("Waiting %u ms vs rem %u ms", timeout_ms, remaining_ms);
/* If the new deadline is sooner, override any existing
* deadline; otherwise schedule without changing any existing
* deadline.
*/
if (timeout_ms < remaining_ms) {
k_work_reschedule(&pending_store, K_MSEC(timeout_ms));
} else {
k_work_schedule(&pending_store, K_MSEC(timeout_ms));
}
BT_DBG("Waiting %d seconds", timeout_ms / MSEC_PER_SEC);
k_delayed_work_submit(&pending_store, K_MSEC(timeout_ms));
}
static void store_pending(struct ble_npl_event *work)
{
@@ -201,7 +204,7 @@ void bt_mesh_settings_init(void)
SYSINIT_PANIC_ASSERT_MSG(rc == 0,
"Failed to register bt_mesh_settings conf");
k_delayed_work_init(&pending_store, store_pending);
k_work_init_delayable(&pending_store, store_pending);
}
#endif /* MYNEWT_VAL(BLE_MESH_SETTINGS) */
+23 -23
View File
@@ -107,7 +107,7 @@ static struct seg_tx {
friend_cred:1; /* Using Friend credentials */
const struct bt_mesh_send_cb *cb;
void *cb_data;
struct k_delayed_work retransmit; /* Retransmit timer */
struct k_work_delayable retransmit; /* Retransmit timer */
} seg_tx[MYNEWT_VAL(BLE_MESH_TX_SEG_MSG_COUNT)];
static struct seg_rx {
@@ -125,7 +125,7 @@ static struct seg_rx {
uint8_t ttl;
uint32_t block;
uint32_t last;
struct k_delayed_work ack;
struct k_work_delayable ack;
} seg_rx[CONFIG_BT_MESH_RX_SEG_MSG_COUNT];
@@ -248,7 +248,7 @@ static void seg_tx_unblock_check(struct seg_tx *tx)
BT_DBG("Unblocked 0x%04x",
(uint16_t)(blocked->seq_auth & TRANS_SEQ_ZERO_MASK));
blocked->blocked = false;
k_delayed_work_submit(&blocked->retransmit, 0);
k_work_reschedule(&blocked->retransmit, 0);
}
}
@@ -256,7 +256,7 @@ static void seg_tx_reset(struct seg_tx *tx)
{
int i;
k_delayed_work_cancel(&tx->retransmit);
k_work_cancel_delayable(&tx->retransmit);
tx->cb = NULL;
tx->cb_data = NULL;
@@ -317,7 +317,7 @@ static void schedule_retransmit(struct seg_tx *tx)
* called this from inside bt_mesh_net_send), we should continue the
* retransmit immediately, as we just freed up a tx buffer.
*/
k_delayed_work_submit(&tx->retransmit,
k_work_reschedule(&tx->retransmit,
tx->seg_o ? 0 : K_MSEC(SEG_RETRANSMIT_TIMEOUT(tx)));
}
@@ -439,7 +439,7 @@ static void seg_tx_send_unacked(struct seg_tx *tx)
tx->attempts--;
end:
if (!tx->seg_pending) {
k_delayed_work_submit(&tx->retransmit,
k_work_reschedule(&tx->retransmit,
SEG_RETRANSMIT_TIMEOUT(tx));
}
@@ -860,7 +860,7 @@ static int trans_ack(struct bt_mesh_net_rx *rx, uint8_t hdr,
return -EINVAL;
}
k_delayed_work_cancel(&tx->retransmit);
k_work_cancel_delayable(&tx->retransmit);
while ((bit = find_lsb_set(ack))) {
if (tx->seg[bit - 1]) {
@@ -1094,7 +1094,7 @@ static void seg_rx_reset(struct seg_rx *rx, bool full_reset)
BT_DBG("rx %p", rx);
k_delayed_work_cancel(&rx->ack);
k_work_cancel_delayable(&rx->ack);
if (IS_ENABLED(CONFIG_BT_MESH_FRIEND) && rx->obo &&
rx->block != BLOCK_COMPLETE(rx->seg_n)) {
@@ -1148,7 +1148,7 @@ static void seg_ack(struct ble_npl_event *work)
rx->block, rx->obo);
timeout = ack_timeout(rx);
k_delayed_work_submit(&rx->ack, K_MSEC(timeout));
k_work_reschedule(&rx->ack, K_MSEC(timeout));
}
static inline bool sdu_len_is_ok(bool ctl, uint8_t seg_n)
@@ -1429,11 +1429,11 @@ found_rx:
/* Reset the Incomplete Timer */
rx->last = k_uptime_get_32();
if (!k_delayed_work_remaining_get(&rx->ack) &&
if (!k_work_delayable_remaining_get(&rx->ack) &&
!bt_mesh_lpn_established()) {
int32_t timeout = ack_timeout(rx);
k_delayed_work_submit(&rx->ack, K_MSEC(timeout));
k_work_reschedule(&rx->ack, K_MSEC(timeout));
}
/* Allocated segment here */
@@ -1464,7 +1464,7 @@ found_rx:
*pdu_type = BT_MESH_FRIEND_PDU_COMPLETE;
k_delayed_work_cancel(&rx->ack);
k_work_cancel_delayable(&rx->ack);
send_ack(net_rx->sub, net_rx->ctx.recv_dst, net_rx->ctx.addr,
net_rx->ctx.send_ttl, seq_auth, rx->block, rx->obo);
@@ -1641,16 +1641,16 @@ void bt_mesh_trans_init(void)
}
for (i = 0; i < ARRAY_SIZE(seg_tx); i++) {
k_delayed_work_init(&seg_tx[i].retransmit, seg_retransmit);
k_delayed_work_add_arg(&seg_tx[i].retransmit, &seg_tx[i]);
k_work_init_delayable(&seg_tx[i].retransmit, seg_retransmit);
k_work_add_arg_delayable(&seg_tx[i].retransmit, &seg_tx[i]);
}
/* XXX Probably we need mempool for that.
* For now we increase MSYS_1_BLOCK_COUNT
*/
for (i = 0; i < ARRAY_SIZE(seg_rx); i++) {
k_delayed_work_init(&seg_rx[i].ack, seg_ack);
k_delayed_work_add_arg(&seg_rx[i].ack, &seg_rx[i]);
k_work_init_delayable(&seg_rx[i].ack, seg_ack);
k_work_add_arg_delayable(&seg_rx[i].ack, &seg_rx[i]);
}
}
@@ -1856,12 +1856,6 @@ void bt_mesh_va_pending_store(void)
}
}
}
#else
void bt_mesh_va_pending_store(void)
{
/* Do nothing. */
}
#endif /* CONFIG_BT_MESH_LABEL_COUNT > 0 */
static struct conf_handler bt_mesh_va_conf_handler = {
.ch_name = "bt_mesh",
@@ -1880,4 +1874,10 @@ void bt_mesh_va_init(void)
SYSINIT_PANIC_ASSERT_MSG(rc == 0,
"Failed to register bt_mesh_hb_pub conf");
}
#endif
#else
void bt_mesh_va_pending_store(void)
{
/* Do nothing. */
}
#endif /* CONFIG_BT_MESH_LABEL_COUNT > 0 */