Lines Matching refs:rpl

47 static inline int rpl_idx(const struct bt_mesh_rpl *rpl)  in rpl_idx()  argument
49 return rpl - &replay_list[0]; in rpl_idx()
52 static void clear_rpl(struct bt_mesh_rpl *rpl) in clear_rpl() argument
57 if (!rpl->src) { in clear_rpl()
61 atomic_clear_bit(store, rpl_idx(rpl)); in clear_rpl()
63 snprintk(path, sizeof(path), "bt/mesh/RPL/%x", rpl->src); in clear_rpl()
85 void bt_mesh_rpl_update(struct bt_mesh_rpl *rpl, in bt_mesh_rpl_update() argument
91 if (rpl->old_iv && !rx->old_iv) { in bt_mesh_rpl_update()
92 rpl->seg = 0; in bt_mesh_rpl_update()
95 rpl->src = rx->ctx.addr; in bt_mesh_rpl_update()
96 rpl->seq = rx->seq; in bt_mesh_rpl_update()
97 rpl->old_iv = rx->old_iv; in bt_mesh_rpl_update()
100 schedule_rpl_store(rpl, false); in bt_mesh_rpl_update()
112 struct bt_mesh_rpl *rpl; in bt_mesh_rpl_check() local
126 rpl = &replay_list[i]; in bt_mesh_rpl_check()
129 if (!rpl->src) { in bt_mesh_rpl_check()
134 if (rpl->src == rx->ctx.addr) { in bt_mesh_rpl_check()
135 if (!rpl->old_iv && in bt_mesh_rpl_check()
146 if (rx->old_iv && !rpl->old_iv) { in bt_mesh_rpl_check()
150 if ((!rx->old_iv && rpl->old_iv) || in bt_mesh_rpl_check()
151 rpl->seq < rx->seq) { in bt_mesh_rpl_check()
164 *match = rpl; in bt_mesh_rpl_check()
166 bt_mesh_rpl_update(rpl, rx); in bt_mesh_rpl_check()
222 struct bt_mesh_rpl *rpl = &replay_list[i]; in bt_mesh_rpl_reset() local
224 if (!rpl->src) { in bt_mesh_rpl_reset()
231 atomic_set_bit_to(store, i, !rpl->old_iv); in bt_mesh_rpl_reset()
232 rpl->old_iv = !rpl->old_iv; in bt_mesh_rpl_reset()
244 struct bt_mesh_rpl *rpl = &replay_list[i]; in bt_mesh_rpl_reset() local
246 if (rpl->src) { in bt_mesh_rpl_reset()
247 if (rpl->old_iv) { in bt_mesh_rpl_reset()
248 (void)memset(rpl, 0, sizeof(*rpl)); in bt_mesh_rpl_reset()
252 rpl->old_iv = true; in bt_mesh_rpl_reset()
255 replay_list[i - shift] = *rpl; in bt_mesh_rpl_reset()
271 struct rpl_val rpl; in rpl_set() local
302 err = bt_mesh_settings_set(read_cb, cb_arg, &rpl, sizeof(rpl)); in rpl_set()
308 entry->seq = rpl.seq; in rpl_set()
309 entry->old_iv = rpl.old_iv; in rpl_set()
317 BT_MESH_SETTINGS_DEFINE(rpl, "RPL", rpl_set);
321 struct rpl_val rpl = {0}; in store_rpl() local
331 rpl.seq = entry->seq; in store_rpl()
332 rpl.old_iv = entry->old_iv; in store_rpl()
336 err = settings_save_one(path, &rpl, sizeof(rpl)); in store_rpl()
365 struct bt_mesh_rpl *rpl = &replay_list[i]; in bt_mesh_rpl_pending_store() local
367 if (addr != BT_MESH_ADDR_ALL_NODES && addr != rpl->src) { in bt_mesh_rpl_pending_store()
372 clear_rpl(rpl); in bt_mesh_rpl_pending_store()
376 replay_list[i - shift] = *rpl; in bt_mesh_rpl_pending_store()
381 clear_rpl(rpl); in bt_mesh_rpl_pending_store()
387 replay_list[i - shift] = *rpl; in bt_mesh_rpl_pending_store()