From 68e7bb8065efac75e3af7ff5239e3c19a7092a73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Kopy=C5=9Bci=C5=84ski?= Date: Tue, 15 Dec 2020 11:58:39 +0100 Subject: [PATCH] mesh: Fixes LPN poll timeout gradually grow `POLL_TIMEOUT_MAX` should use `CONFIG_BT_MESH_LPN_POLL_TIMEOUT` instead of `CONFIG_BT_MESH_LPN_INIT_POLL_TIMEOUT`. The described algorithm to grow the poll timeout implemented in function poll_timeout does not work with this implementation. It's a regression in 3b4d58a Bluetooth: Mesh: optimize performance for lpn node This is port of aea9adfc8968e9210a4f58ac493fdc074478527b --- nimble/host/mesh/src/lpn.c | 6 ++++-- nimble/host/mesh/syscfg.yml | 10 ++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/nimble/host/mesh/src/lpn.c b/nimble/host/mesh/src/lpn.c index 7919e9561..e9e412569 100644 --- a/nimble/host/mesh/src/lpn.c +++ b/nimble/host/mesh/src/lpn.c @@ -48,11 +48,13 @@ #define POLL_TIMEOUT_INIT (MYNEWT_VAL(BLE_MESH_LPN_INIT_POLL_TIMEOUT) * 100) +#define POLL_TIMEOUT (MYNEWT_VAL(BLE_MESH_LPN_RECV_DELAY) * 100) + #define REQ_ATTEMPTS_MAX 6 #define REQ_ATTEMPTS(lpn) MIN(REQ_ATTEMPTS_MAX, \ - POLL_TIMEOUT_INIT / REQ_RETRY_DURATION(lpn)) + POLL_TIMEOUT / REQ_RETRY_DURATION(lpn)) -#define POLL_TIMEOUT_MAX(lpn) (POLL_TIMEOUT_INIT - \ +#define POLL_TIMEOUT_MAX(lpn) (POLL_TIMEOUT - \ (REQ_ATTEMPTS(lpn) * REQ_RETRY_DURATION(lpn))) #define CLEAR_ATTEMPTS 3 diff --git a/nimble/host/mesh/syscfg.yml b/nimble/host/mesh/syscfg.yml index ed8a31b79..cf0c7f750 100644 --- a/nimble/host/mesh/syscfg.yml +++ b/nimble/host/mesh/syscfg.yml @@ -436,6 +436,16 @@ syscfg.defs: a value of 300 means 30 seconds. value: 300 + BLE_MESH_LPN_POLL_TIMEOUT: + description: > + PollTimeout timer is used to measure time between two + consecutive requests sent by the Low Power node. If no + requests are received by the Friend node before the + PollTimeout timer expires, then the friendship is considered + terminated. The value is in units of 100 milliseconds, so e.g. + a value of 300 means 30 seconds. + value: 300 + BLE_MESH_LPN_INIT_POLL_TIMEOUT: description: > The initial value of the PollTimeout timer when Friendship