Bluetooth: Mesh: Increase initial poll timeout

The purpose of using something less than the configured poll timeout
was to cover the case where the LPN establishes Friendship before the
provisioner has completely configured it. However, there's the "more
data" flag in the initial Friend Response, and we now also have a
public API to request for more messages. Both of these features
diminish the value of having a reduced initial timeout. Also, some LPN
test cases do not expect us to send frequent polls initially, causing
failures with the PTS.

Therefore, introduce a Kconfig option to set the initial timeout, and
make it default to the actual poll timeout.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
Johan Hedberg 2017-11-23 09:48:41 +02:00 committed by Johan Hedberg
commit 4cc6a4fcbb
2 changed files with 18 additions and 4 deletions

View file

@ -259,15 +259,27 @@ config BT_MESH_LPN_RECV_DELAY
is in units of milliseconds. is in units of milliseconds.
config BT_MESH_LPN_POLL_TIMEOUT config BT_MESH_LPN_POLL_TIMEOUT
int "The initial value of the PollTimeout timer" int "The value of the PollTimeout timer"
range 10 244735 range 10 244735
default 100 default 300
help help
PollTimeout timer is used to measure time between two PollTimeout timer is used to measure time between two
consecutive requests sent by the Low Power node. If no consecutive requests sent by the Low Power node. If no
requests are received by the Friend node before the requests are received by the Friend node before the
PollTimeout timer expires, then the friendship is considered PollTimeout timer expires, then the friendship is considered
terminated. The value is in units of 100 milliseconds. terminated. The value is in units of 100 milliseconds, so e.g.
a value of 300 means 3 seconds.
config BT_MESH_LPN_INIT_POLL_TIMEOUT
int "The starting value of the PollTimeout timer"
range 10 BT_MESH_LPN_POLL_TIMEOUT
default BT_MESH_LPN_POLL_TIMEOUT
help
The initial value of the PollTimeout timer when Friendship
gets established for the first time. After this the timeout
will gradually grow toward the actual PollTimeout, doubling
in value for each iteration. The value is in units of 100
milliseconds, so e.g. a value of 300 means 3 seconds.
config BT_MESH_LPN_SCAN_LATENCY config BT_MESH_LPN_SCAN_LATENCY
int "Latency for enabling scanning" int "Latency for enabling scanning"

View file

@ -48,6 +48,7 @@
#define REQ_RETRY_DURATION(lpn) (4 * (LPN_RECV_DELAY + (lpn)->adv_duration + \ #define REQ_RETRY_DURATION(lpn) (4 * (LPN_RECV_DELAY + (lpn)->adv_duration + \
(lpn)->recv_win + POLL_RETRY_TIMEOUT)) (lpn)->recv_win + POLL_RETRY_TIMEOUT))
#define POLL_TIMEOUT_INIT (CONFIG_BT_MESH_LPN_INIT_POLL_TIMEOUT * 100)
#define POLL_TIMEOUT_MAX(lpn) ((CONFIG_BT_MESH_LPN_POLL_TIMEOUT * 100) - \ #define POLL_TIMEOUT_MAX(lpn) ((CONFIG_BT_MESH_LPN_POLL_TIMEOUT * 100) - \
REQ_RETRY_DURATION(lpn)) REQ_RETRY_DURATION(lpn))
@ -964,7 +965,8 @@ int bt_mesh_lpn_friend_update(struct bt_mesh_net_rx *rx,
} }
/* Set initial poll timeout */ /* Set initial poll timeout */
lpn->poll_timeout = min(POLL_TIMEOUT_MAX(lpn), K_SECONDS(1)); lpn->poll_timeout = min(POLL_TIMEOUT_MAX(lpn),
POLL_TIMEOUT_INIT);
} }
friend_response_received(lpn); friend_response_received(lpn);