1# Kconfig - Bluetooth Mesh configuration options
2
3#
4# Copyright (c) 2017 Intel Corporation
5#
6# SPDX-License-Identifier: Apache-2.0
7#
8
9menuconfig BT_MESH
10	bool "Bluetooth Mesh support"
11	select TINYCRYPT
12	select TINYCRYPT_AES
13	select TINYCRYPT_AES_CMAC
14	depends on BT_OBSERVER && BT_BROADCASTER
15	help
16	  This option enables Bluetooth Mesh support. The specific
17	  features that are available may depend on other features
18	  that have been enabled in the stack, such as GATT support.
19
20if BT_MESH
21
22# Virtual option enabled whenever Generic Provisioning layer is needed
23config BT_MESH_PROV
24	bool
25	select BT_ECC
26
27config BT_MESH_PB_ADV
28	bool "Provisioning support using the advertising bearer (PB-ADV)"
29	select BT_MESH_PROV
30	default y
31	help
32	  Enable this option to allow the device to be provisioned over
33	  the advertising bearer.
34
35if BT_CONN
36
37# Virtual option enabled whenever any Proxy protocol is needed
38config BT_MESH_PROXY
39	bool
40
41config BT_MESH_PB_GATT
42	bool "Provisioning support using GATT (PB-GATT)"
43	select BT_MESH_PROXY
44	select BT_MESH_PROV
45	help
46	  Enable this option to allow the device to be provisioned over
47	  GATT.
48
49config BT_MESH_GATT_PROXY
50	bool "GATT Proxy Service"
51	select BT_MESH_PROXY
52	help
53	  This option enables support for the Mesh GATT Proxy Service,
54	  i.e. the ability to act as a proxy between a Mesh GATT Client
55	  and a Mesh network.
56
57config BT_MESH_NODE_ID_TIMEOUT
58	int "Node Identity advertising timeout"
59	depends on BT_MESH_GATT_PROXY
60	range 1 60
61	default 60
62	help
63	  This option determines for how long the local node advertises
64	  using Node Identity. The given value is in seconds. The
65	  specification limits this to 60 seconds, and implies that to
66	  be the appropriate value as well, so just leaving this as the
67	  default is the safest option.
68
69if BT_MESH_PROXY
70
71config BT_MESH_PROXY_FILTER_SIZE
72	int "Maximum number of filter entries per Proxy Client"
73	default 3 if BT_MESH_GATT_PROXY
74	default 1
75	range 1 32767
76	help
77	  This option specifies how many Proxy Filter entries the local
78	  node supports.
79
80endif # BT_MESH_PROXY
81
82endif # BT_CONN
83
84config BT_MESH_SELF_TEST
85	bool "Perform self-tests"
86	help
87	  This option adds extra self-tests which are run every time
88	  mesh networking is initialized.
89
90config BT_MESH_IV_UPDATE_TEST
91	bool "Test the IV Update Procedure"
92	help
93	  This option removes the 96 hour limit of the IV Update
94	  Procedure and lets the state be changed at any time.
95
96config BT_MESH_SUBNET_COUNT
97	int "Maximum number of mesh subnets per network"
98	default 1
99	range 1 4096
100	help
101	  This option specifies how many subnets a Mesh network can
102	  participate in at the same time.
103
104config BT_MESH_APP_KEY_COUNT
105	int "Maximum number of application keys per network"
106	default 1
107	range 1 4096
108	help
109	  This option specifies how many application keys the device can
110	  store per network.
111
112config BT_MESH_MODEL_KEY_COUNT
113	int "Maximum number of application keys per model"
114	default 1
115	range 1 4096
116	help
117	  This option specifies how many application keys each model can
118	  at most be bound to.
119
120config BT_MESH_MODEL_GROUP_COUNT
121	int "Maximum number of group address subscriptions per model"
122	default 1
123	range 1 4096
124	help
125	  This option specifies how many group addresses each model can
126	  at most be subscribed to.
127
128config BT_MESH_LABEL_COUNT
129	int "Maximum number of Label UUIDs used for Virtual Addresses"
130	default 1
131	range 0 4096
132	help
133	  This option specifies how many Label UUIDs can be stored.
134
135config BT_MESH_CRPL
136	int "Maximum capacity of the replay protection list"
137	default 10
138	range 2 65535
139	help
140	  This options specifies the maximum capacity of the replay
141	  protection list. This option is similar to the network message
142	  cache size, but has a different purpose.
143
144config BT_MESH_MSG_CACHE_SIZE
145	int "Network message cache size"
146	default 10
147	range 2 65535
148	help
149	  Number of messages that are cached for the network. This helps
150	  prevent unnecessary decryption operations and unnecessary
151	  relays. This option is similar to the replay protection list,
152	  but has a different purpose.
153
154config BT_MESH_ADV_BUF_COUNT
155	int "Number of advertising buffers"
156	default 6
157	range 6 256
158	help
159	  Number of advertising buffers available. This should be chosen
160	  based on what kind of features the local node should have. E.g.
161	  a relay will perform better the more buffers it has. Another
162	  thing to consider is outgoing segmented messages. There must
163	  be at least three more advertising buffers than the maximum
164	  supported outgoing segment count (BT_MESH_TX_SEG_MAX).
165
166config BT_MESH_IVU_DIVIDER
167	int "Divider for IV Update state refresh timer"
168	default 4
169	range 2 96
170	help
171	  When the IV Update state enters Normal operation or IV Update
172	  in Progress, we need to keep track of how many hours has passed
173	  in the state, since the specification requires us to remain in
174	  the state at least for 96 hours (Update in Progress has an
175	  additional upper limit of 144 hours).
176
177	  In order to fulfill the above requirement, even if the node might
178	  be powered off once in a while, we need to store persistently
179	  how many hours the node has been in the state. This doesn't
180	  necessarily need to happen every hour (thanks to the flexible
181	  duration range). The exact cadence will depend a lot on the
182	  ways that the node will be used and what kind of power source it
183	  has.
184
185	  Since there is no single optimal answer, this configuration
186	  option allows specifying a divider, i.e. how many intervals
187	  the 96 hour minimum gets split into. After each interval the
188	  duration that the node has been in the current state gets
189	  stored to flash. E.g. the default value of 4 means that the
190	  state is saved every 24 hours (96 / 4).
191
192config BT_MESH_TX_SEG_MSG_COUNT
193	int "Maximum number of simultaneous outgoing segmented messages"
194	default 1
195	range 1 BT_MESH_ADV_BUF_COUNT
196	help
197	  Maximum number of simultaneous outgoing multi-segment and/or
198	  reliable messages.
199
200config BT_MESH_RX_SEG_MSG_COUNT
201	int "Maximum number of simultaneous incoming segmented messages"
202	default 1
203	range 1 255
204	help
205	  Maximum number of simultaneous incoming multi-segment and/or
206	  reliable messages.
207
208config BT_MESH_RX_SDU_MAX
209	int "Maximum incoming Upper Transport Access PDU length"
210	default 72
211	range 24 384
212	help
213	  Maximum incoming Upper Transport Access PDU length. This
214	  determines also how many segments incoming segmented messages
215	  can have. Each segment can contain 12 bytes, so this value should
216	  be set to a multiple of 12 to avoid wasted memory. The minimum
217	  requirement is 2 segments (24 bytes) whereas the maximum supported
218	  by the Mesh specification is 32 segments (384 bytes).
219
220config BT_MESH_TX_SEG_MAX
221	int "Maximum number of segments in outgoing messages"
222	default 3
223	range 2 32
224	help
225	  Maximum number of segments supported for outgoing messages.
226	  This value should typically be fine-tuned based on what
227	  models the local node supports, i.e. what's the largest
228	  message payload that the node needs to be able to send.
229	  This value affects memory and call stack consumption, which
230	  is why the default is lower than the maximum that the
231	  specification would allow (32 segments).
232
233	  The maximum outgoing SDU size is 12 times this number (out of
234	  which 4 or 8 bytes is used for the Transport Layer MIC). For
235	  example, 5 segments means the maximum SDU size is 60 bytes,
236	  which leaves 56 bytes for application layer data using a
237	  4-byte MIC and 52 bytes using an 8-byte MIC.
238
239	  Be sure to specify a sufficient number of advertising buffers
240	  when setting this option to a higher value. There must be at
241	  least three more advertising buffers (BT_MESH_ADV_BUF_COUNT)
242	  as there are outgoing segments.
243
244config BT_MESH_RELAY
245	bool "Relay support"
246	help
247	  Support for acting as a Mesh Relay Node.
248
249config BT_MESH_LOW_POWER
250	bool "Support for Low Power features"
251	help
252	  Enable this option to be able to act as a Low Power Node.
253
254if BT_MESH_LOW_POWER
255
256config BT_MESH_LPN_ESTABLISHMENT
257	bool "Perform Friendship establishment using low power"
258	default y
259	help
260	  Perform the Friendship establishment using low power, with
261	  the help of a reduced scan duty cycle. The downside of this
262	  is that the node may miss out on messages intended for it
263	  until it has successfully set up Friendship with a Friend
264	  node.
265
266config BT_MESH_LPN_AUTO
267	bool "Automatically start looking for Friend nodes once provisioned"
268	default y
269	help
270	  Automatically enable LPN functionality once provisioned and start
271	  looking for Friend nodes. If this option is disabled LPN mode
272	  needs to be manually enabled by calling bt_mesh_lpn_set(true).
273
274config BT_MESH_LPN_AUTO_TIMEOUT
275	int "Time from last received message before going to LPN mode"
276	default 15
277	range 0 3600
278	depends on BT_MESH_LPN_AUTO
279	help
280	  Time in seconds from the last received message, that the node
281	  will wait before starting to look for Friend nodes.
282
283config BT_MESH_LPN_RETRY_TIMEOUT
284	int "Retry timeout for Friend requests"
285	default 8
286	range 1 3600
287	help
288	  Time in seconds between Friend Requests, if a previous Friend
289	  Request did not receive any acceptable Friend Offers.
290
291config BT_MESH_LPN_RSSI_FACTOR
292	int "RSSIFactor, used in the Friend Offer Delay calculation"
293	range 0 3
294	default 0
295	help
296	  The contribution of the RSSI measured by the Friend node used
297	  in Friend Offer Delay calculations. 0 = 1, 1 = 1.5, 2 = 2, 3 = 2.5.
298
299config BT_MESH_LPN_RECV_WIN_FACTOR
300	int "ReceiveWindowFactor, used in the Friend Offer Delay calculation"
301	range 0 3
302	default 0
303	help
304	  The contribution of the supported Receive Window used in
305	  Friend Offer Delay calculations. 0 = 1, 1 = 1.5, 2 = 2, 3 = 2.5.
306
307config BT_MESH_LPN_MIN_QUEUE_SIZE
308	int "Minimum size of acceptable friend queue (MinQueueSizeLog)"
309	range 1 7
310	default 1
311	help
312	  The MinQueueSizeLog field is defined as log_2(N), where N is
313	  the minimum number of maximum size Lower Transport PDUs that
314	  the Friend node can store in its Friend Queue. As an example,
315	  MinQueueSizeLog value 1 gives N = 2, and value 7 gives N = 128.
316
317config BT_MESH_LPN_RECV_DELAY
318	int "Receive delay requested by the local node"
319	range 10 255
320	default 100
321	help
322	  The ReceiveDelay is the time between the Low Power node
323	  sending a request and listening for a response. This delay
324	  allows the Friend node time to prepare the response. The value
325	  is in units of milliseconds.
326
327config BT_MESH_LPN_POLL_TIMEOUT
328	int "The value of the PollTimeout timer"
329	range 10 244735
330	default 300
331	help
332	  PollTimeout timer is used to measure time between two
333	  consecutive requests sent by the Low Power node. If no
334	  requests are received by the Friend node before the
335	  PollTimeout timer expires, then the friendship is considered
336	  terminated. The value is in units of 100 milliseconds, so e.g.
337	  a value of 300 means 30 seconds.
338
339config BT_MESH_LPN_INIT_POLL_TIMEOUT
340	int "The starting value of the PollTimeout timer"
341	range 10 BT_MESH_LPN_POLL_TIMEOUT
342	default BT_MESH_LPN_POLL_TIMEOUT
343	help
344	  The initial value of the PollTimeout timer when Friendship
345	  gets established for the first time. After this the timeout
346	  will gradually grow toward the actual PollTimeout, doubling
347	  in value for each iteration. The value is in units of 100
348	  milliseconds, so e.g. a value of 300 means 30 seconds.
349
350config BT_MESH_LPN_SCAN_LATENCY
351	int "Latency for enabling scanning"
352	range 0 50
353	default 10
354	help
355	  Latency in milliseconds that it takes to enable scanning. This
356	  is in practice how much time in advance before the Receive Window
357	  that scanning is requested to be enabled.
358
359config BT_MESH_LPN_GROUPS
360	int "Number of groups the LPN can subscribe to"
361	range 0 16384
362	default 8
363	help
364	  Maximum number of groups that the LPN can subscribe to.
365endif # BT_MESH_LOW_POWER
366
367config BT_MESH_FRIEND
368	bool "Support for acting as a Friend Node"
369	help
370	  Enable this option to be able to act as a Friend Node.
371
372if BT_MESH_FRIEND
373
374config BT_MESH_FRIEND_RECV_WIN
375	int "Friend Receive Window"
376	range 1 255
377	default 255
378	help
379	  Receive Window in milliseconds supported by the Friend node.
380
381config BT_MESH_FRIEND_QUEUE_SIZE
382	int "Minimum number of buffers supported per Friend Queue"
383	range 2 65536
384	default 16
385	help
386	  Minimum number of buffers available to be stored for each
387	  local Friend Queue.
388
389config BT_MESH_FRIEND_SUB_LIST_SIZE
390	int "Friend Subscription List Size"
391	range 0 1023
392	default 3
393	help
394	  Size of the Subscription List that can be supported by a
395	  Friend node for a Low Power node.
396
397config BT_MESH_FRIEND_LPN_COUNT
398	int "Number of supported LPN nodes"
399	range 1 1000
400	default 2
401	help
402	  Number of Low Power Nodes the Friend can have a Friendship
403	  with simultaneously.
404
405config BT_MESH_FRIEND_SEG_RX
406	int "Number of incomplete segment lists per LPN"
407	range 1 1000
408	default 1
409	help
410	  Number of incomplete segment lists that we track for each LPN
411	  that we are Friends for. In other words, this determines how
412	  many elements we can simultaneously be receiving segmented
413	  messages from when the messages are going into the Friend queue.
414
415endif # BT_MESH_FRIEND
416
417config BT_MESH_CFG_CLI
418	bool "Support for Configuration Client Model"
419	help
420	  Enable support for the configuration client model.
421
422config BT_MESH_HEALTH_CLI
423	bool "Support for Health Client Model"
424	help
425	  Enable support for the health client model.
426
427config BT_MESH_SHELL
428	bool "Enable Bluetooth Mesh shell"
429	select CONSOLE_SHELL
430	depends on BT_MESH_CFG_CLI
431	depends on BT_MESH_HEALTH_CLI
432	help
433	  Activate shell module that provides Bluetooth Mesh commands to
434	  the console.
435
436if BT_SETTINGS
437
438config BT_MESH_STORE_TIMEOUT
439	int "Delay (in seconds) before storing anything persistently"
440	range 0 1000000
441	default 2
442	help
443	  This value defines in seconds how soon any pending changes
444	  are actually written into persistent storage (flash) after
445	  a change occurs.
446
447config BT_MESH_SEQ_STORE_RATE
448	int "How often the sequence number gets updated in storage"
449	range 0 1000000
450	default 128
451	help
452	  This value defines how often the local sequence number gets
453	  updated in persistent storage (i.e. flash). E.g. a value of 100
454	  means that the sequence number will be stored to flash on every
455	  100th increment. If the node sends messages very frequently a
456	  higher value makes more sense, whereas if the node sends
457	  infrequently a value as low as 0 (update storage for every
458	  increment) can make sense. When the stack gets initialized it
459	  will add this number to the last stored one, so that it starts
460	  off with a value that's guaranteed to be larger than the last
461	  one used before power off.
462
463config BT_MESH_RPL_STORE_TIMEOUT
464	int "Minimum frequency that the RPL gets updated in storage"
465	range 0 1000000
466	default 5
467	help
468	  This value defines in seconds how soon the RPL gets written to
469	  persistent storage after a change occurs. If the node receives
470	  messages frequently it may make sense to have this set to a
471	  large value, whereas if the RPL gets updated infrequently a
472	  value as low as 0 (write immediately) may make sense. Note that
473	  if the node operates a security sensitive use case, and there's
474	  a risk of sudden power loss, it may be a security vulnerability
475	  to set this value to anything else than 0 (a power loss before
476	  writing to storage exposes the node to potential message
477	  replay attacks).
478
479endif # BT_SETTINGS
480
481config BT_MESH_DEBUG
482	bool "Enable debug logs"
483	depends on BT_DEBUG
484	help
485	  Use this option to enable debug logs for the Bluetooth
486	  Mesh functionality.
487
488if BT_MESH_DEBUG
489
490config BT_MESH_DEBUG_USE_ID_ADDR
491	bool "Use identity address for all advertising"
492	help
493	  This option forces the usage of the local identity address for
494	  all advertising. This can be a help for debugging (analyzing
495	  traces), however it should never be enabled for a production
496	  build as it compromises the privacy of the device.
497
498config BT_MESH_DEBUG_NET
499	bool "Network layer debug"
500	help
501	  Use this option to enable Network layer debug logs for the
502	  Bluetooth Mesh functionality.
503
504config BT_MESH_DEBUG_TRANS
505	bool "Transport layer debug"
506	help
507	  Use this option to enable Transport layer debug logs for the
508	  Bluetooth Mesh functionality.
509
510config BT_MESH_DEBUG_BEACON
511	bool "Beacon debug"
512	help
513	  Use this option to enable Beacon-related debug logs for the
514	  Bluetooth Mesh functionality.
515
516config BT_MESH_DEBUG_CRYPTO
517	bool "Crypto debug"
518	help
519	  Use this option to enable cryptographic debug logs for the
520	  Bluetooth Mesh functionality.
521
522config BT_MESH_DEBUG_PROV
523	bool "Provisioning debug"
524	help
525	  Use this option to enable Provisioning debug logs for the
526	  Bluetooth Mesh functionality.
527
528config BT_MESH_DEBUG_ACCESS
529	bool "Access layer debug"
530	help
531	  Use this option to enable Access layer and device composition
532	  related debug logs for Bluetooth Mesh.
533
534config BT_MESH_DEBUG_MODEL
535	bool "Foundation model debug"
536	help
537	  Use this option to enable debug logs for the Foundation
538	  Models.
539
540config BT_MESH_DEBUG_ADV
541	bool "Advertising debug"
542	help
543	  Use this option to enable advertising debug logs for
544	  the Bluetooth Mesh functionality.
545
546config BT_MESH_DEBUG_LOW_POWER
547	bool "Low Power debug"
548	help
549	  Use this option to enable Low Power debug logs for the
550	  Bluetooth Mesh functionality.
551
552config BT_MESH_DEBUG_FRIEND
553	bool "Friend debug"
554	help
555	  Use this option to enable Friend debug logs for the
556	  Bluetooth Mesh functionality.
557
558config BT_MESH_DEBUG_PROXY
559	bool "Proxy debug"
560	depends on BT_MESH_PROXY
561	help
562	  Use this option to enable Proxy protocol debug logs.
563
564config BT_MESH_DEBUG_SETTINGS
565	bool "Persistent settings debug"
566	depends on BT_SETTINGS
567	help
568	  Use this option to enable persistent settings debug logs.
569
570endif # BT_MESH_DEBUG
571
572endif # BT_MESH
573