1 /* 2 * Copyright (c) 2019, The OpenThread Authors. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. 9 * 2. Redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution. 12 * 3. Neither the name of the copyright holder nor the 13 * names of its contributors may be used to endorse or promote products 14 * derived from this software without specific prior written permission. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 * POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29 /** 30 * @file 31 * This file includes compile-time configurations for the MLE service. 32 */ 33 34 #ifndef CONFIG_MLE_H_ 35 #define CONFIG_MLE_H_ 36 37 /** 38 * @addtogroup config-mle 39 * 40 * @brief 41 * This module includes configuration variables for the MLE service. 42 * 43 * @{ 44 */ 45 46 /** 47 * @def OPENTHREAD_CONFIG_MLE_MAX_ROUTERS 48 * 49 * The maximum number of routers in a Thread network. 50 * 51 * @note Thread specifies this value to be 32. Changing this value may cause interoperability issues with standard 52 * Thread 1.1 devices. 53 */ 54 #ifndef OPENTHREAD_CONFIG_MLE_MAX_ROUTERS 55 #define OPENTHREAD_CONFIG_MLE_MAX_ROUTERS 32 56 #endif 57 58 /** 59 * @def OPENTHREAD_CONFIG_MLE_MAX_CHILDREN 60 * 61 * The maximum number of children. 62 */ 63 #ifndef OPENTHREAD_CONFIG_MLE_MAX_CHILDREN 64 #define OPENTHREAD_CONFIG_MLE_MAX_CHILDREN 10 65 #endif 66 67 /** 68 * @def OPENTHREAD_CONFIG_MLE_CHILD_TIMEOUT_DEFAULT 69 * 70 * The default child timeout value (in seconds). 71 */ 72 #ifndef OPENTHREAD_CONFIG_MLE_CHILD_TIMEOUT_DEFAULT 73 #define OPENTHREAD_CONFIG_MLE_CHILD_TIMEOUT_DEFAULT 240 74 #endif 75 76 /** 77 * @def OPENTHREAD_CONFIG_MLE_IP_ADDRS_PER_CHILD 78 * 79 * The maximum number of supported IPv6 address registrations per child. 80 */ 81 #ifndef OPENTHREAD_CONFIG_MLE_IP_ADDRS_PER_CHILD 82 #define OPENTHREAD_CONFIG_MLE_IP_ADDRS_PER_CHILD 4 83 #endif 84 85 /** 86 * @def OPENTHREAD_CONFIG_MLE_IP_ADDRS_TO_REGISTER 87 * 88 * The maximum number of IPv6 address registrations for MTD. 89 */ 90 #ifndef OPENTHREAD_CONFIG_MLE_IP_ADDRS_TO_REGISTER 91 #define OPENTHREAD_CONFIG_MLE_IP_ADDRS_TO_REGISTER (OPENTHREAD_CONFIG_MLE_IP_ADDRS_PER_CHILD) 92 #endif 93 94 /** 95 * @def OPENTHREAD_CONFIG_MLE_DEVICE_PROPERTY_LEADER_WEIGHT_ENABLE 96 * 97 * Define as 1 to enable feature to set device properties which are used for calculating the local leader weight on a 98 * device. 99 * 100 * It is enabled by default on Thread Version 1.4 or later. 101 */ 102 #ifndef OPENTHREAD_CONFIG_MLE_DEVICE_PROPERTY_LEADER_WEIGHT_ENABLE 103 #define OPENTHREAD_CONFIG_MLE_DEVICE_PROPERTY_LEADER_WEIGHT_ENABLE \ 104 (OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_4) 105 #endif 106 107 /** 108 * @def OPENTHREAD_CONFIG_MLE_DEFAULT_LEADER_WEIGHT_ADJUSTMENT 109 * 110 * Specifies the default value for `mLeaderWeightAdjustment` in `otDeviceProperties`. MUST be from -16 up to +16. 111 * 112 * This value is used to adjust the calculated Leader Weight from `otDeviceProperties`. 113 */ 114 #ifndef OPENTHREAD_CONFIG_MLE_DEFAULT_LEADER_WEIGHT_ADJUSTMENT 115 #define OPENTHREAD_CONFIG_MLE_DEFAULT_LEADER_WEIGHT_ADJUSTMENT 0 116 #endif 117 118 /** 119 * @def OPENTHREAD_CONFIG_MLE_STEERING_DATA_SET_OOB_ENABLE 120 * 121 * Enable setting steering data out of band. 122 */ 123 #ifndef OPENTHREAD_CONFIG_MLE_STEERING_DATA_SET_OOB_ENABLE 124 #define OPENTHREAD_CONFIG_MLE_STEERING_DATA_SET_OOB_ENABLE 0 125 #endif 126 127 /** 128 * @def OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_ENABLE 129 * 130 * Define as 1 to enable attach backoff feature 131 * 132 * When this feature is enabled, an exponentially increasing backoff wait time is added between attach attempts. 133 * If device is sleepy, the radio will be put to sleep during the wait time. This ensures that a battery-powered sleepy 134 * end-device does not drain its battery by continuously searching for a parent to attach to (when there is no 135 * router/parent for it to attach). 136 * 137 * The backoff time starts from a minimum interval specified by 138 * `OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_MINIMUM_INTERVAL`, and every attach attempt the wait time is doubled up to 139 * `OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_MAXIMUM_INTERVAL` which specifies the maximum wait time. 140 * 141 * Once the wait time reaches the maximum, a random jitter interval is added to it. The maximum value for jitter is 142 * specified by `OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_JITTER_INTERVAL`. The random jitter is selected uniformly within 143 * range `[-JITTER, +JITTER]`. It is only added when the backoff wait interval is at maximum value. 144 */ 145 #ifndef OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_ENABLE 146 #define OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_ENABLE 1 147 #endif 148 149 /** 150 * @def OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_MINIMUM_INTERVAL 151 * 152 * Specifies the minimum backoff wait interval (in milliseconds) used by attach backoff feature. 153 * 154 * Applicable only if attach backoff feature is enabled (see `OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_ENABLE`). 155 * 156 * Please see `OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_ENABLE` description for more details. 157 */ 158 #ifndef OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_MINIMUM_INTERVAL 159 #define OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_MINIMUM_INTERVAL 251 160 #endif 161 162 /** 163 * @def OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_MAXIMUM_INTERVAL 164 * 165 * Specifies the maximum backoff wait interval (in milliseconds) used by attach backoff feature. 166 * 167 * Applicable only if attach backoff feature is enabled (see `OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_ENABLE`). 168 * 169 * Please see `OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_ENABLE` description for more details. 170 */ 171 #ifndef OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_MAXIMUM_INTERVAL 172 #define OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_MAXIMUM_INTERVAL 1200000 // 1200 seconds = 20 minutes 173 #endif 174 175 /** 176 * @def OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_JITTER_INTERVAL 177 * 178 * Specifies the maximum jitter interval (in milliseconds) used by attach backoff feature. 179 * 180 * Applicable only if attach backoff feature is enabled (see `OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_ENABLE`). 181 * 182 * Please see `OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_ENABLE` description for more details. 183 */ 184 #ifndef OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_JITTER_INTERVAL 185 #define OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_JITTER_INTERVAL 2000 186 #endif 187 188 /** 189 * @def OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_DELAY_TO_RESET_BACKOFF_INTERVAL 190 * 191 * Specifies the delay wait interval (in milliseconds) used by attach backoff feature after a successful attach before 192 * it resets the current backoff interval back to the minimum value. 193 * 194 * If it is set to zero then the device resets its backoff attach interval immediately after a successful attach. With 195 * a non-zero value, if after a successful attach, the device happens to detach within the delay interval, the reattach 196 * process resumes with the previous backoff interval (as if the attach did not happen). 197 * 198 * This behavior is helpful in the situation where a battery-powered device has poor link quality to its parent and 199 * therefore attaches and detaches frequently from the parent. Using a non-zero wait interval ensures that the attach 200 * backoff interval does not reset on each attach and that the device does not drain its battery quickly trying to 201 * re-attach too frequently. 202 */ 203 #ifndef OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_DELAY_TO_RESET_BACKOFF_INTERVAL 204 #define OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_DELAY_TO_RESET_BACKOFF_INTERVAL 20000 205 #endif 206 207 /** 208 * @def OPENTHREAD_CONFIG_MLE_LINK_REQUEST_MARGIN_MIN 209 * 210 * Specifies the minimum link margin in dBm required before attempting to establish a link with a neighboring router. 211 */ 212 #ifndef OPENTHREAD_CONFIG_MLE_LINK_REQUEST_MARGIN_MIN 213 #define OPENTHREAD_CONFIG_MLE_LINK_REQUEST_MARGIN_MIN 10 214 #endif 215 216 /** 217 * @def OPENTHREAD_CONFIG_MLE_PARTITION_MERGE_MARGIN_MIN 218 * 219 * Specifies the minimum link margin in dBm required before attempting to merge to a different partition. 220 */ 221 #ifndef OPENTHREAD_CONFIG_MLE_PARTITION_MERGE_MARGIN_MIN 222 #define OPENTHREAD_CONFIG_MLE_PARTITION_MERGE_MARGIN_MIN 10 223 #endif 224 225 /** 226 * @def OPENTHREAD_CONFIG_MLE_CHILD_ROUTER_LINKS 227 * 228 * Specifies the desired number of router links that a REED / FED attempts to maintain. 229 * 230 * This is default value used on an FTD child. This parameter can also be changed at run-time using the public APIs 231 * `otThreadGetChildRouterLinks/otThreadSetChildRouterLinks()`. 232 */ 233 #ifndef OPENTHREAD_CONFIG_MLE_CHILD_ROUTER_LINKS 234 #define OPENTHREAD_CONFIG_MLE_CHILD_ROUTER_LINKS 3 235 #endif 236 237 /** 238 * @def OPENTHREAD_CONFIG_MLE_EXTRA_CHILD_ROUTER_LINKS_GRADUAL 239 * 240 * Specifies the extra router links in addition to those specified by `otThreadSetChildRouterLinks()` that an FTD child 241 * can try to establish gradually over a longer span of time. 242 * 243 * A child device communicates through its parent but can establish links with other neighboring routers so that it can 244 * receive multicast messages (forwarded MPL) from other routers, thus improving multicast reliability. 245 * 246 * An FTD child tries to establish links with the first `CHILD_ROUTER_LINK` routers as quickly as possible 247 * (sending MLE Link Request to initiate link upon receiving advertisements from a neighboring router). 248 * 249 * After that, the FTD child uses the "gradual router link establishment" mechanism to establish router links with 250 * `OPENTHREAD_CONFIG_MLE_EXTRA_CHILD_ROUTER_LINKS_GRADUAL` additional routers. This is done slowly and over a longer 251 * span of time. 252 * 253 * This parameter can be set to zero to disable "gradual router link establishment" fully. Alternatively, it can be set 254 * to the maximum router count of 32 to allow the FTD child to establish links with all neighboring routers. 255 */ 256 #ifndef OPENTHREAD_CONFIG_MLE_EXTRA_CHILD_ROUTER_LINKS_GRADUAL 257 #define OPENTHREAD_CONFIG_MLE_EXTRA_CHILD_ROUTER_LINKS_GRADUAL 32 258 #endif 259 260 /** 261 * @def OPENTHREAD_CONFIG_MLE_LONG_ROUTES_ENABLE 262 * 263 * Enable experimental mode for 'deep' networks, allowing packet routes up to 32 nodes. 264 * This mode is incompatible with Thread 1.1.1 and older. 265 */ 266 #ifndef OPENTHREAD_CONFIG_MLE_LONG_ROUTES_ENABLE 267 #define OPENTHREAD_CONFIG_MLE_LONG_ROUTES_ENABLE 0 268 #endif 269 270 /** 271 * @def OPENTHREAD_CONFIG_MLE_SEND_UNICAST_ANNOUNCE_RESPONSE 272 * 273 * Define as 1 to enable sending of a unicast MLE Announce message in response to a received Announce message from 274 * a device. 275 * 276 * @note The unicast MLE announce message is sent in addition to (and after) the multicast MLE Announce. 277 */ 278 #ifndef OPENTHREAD_CONFIG_MLE_SEND_UNICAST_ANNOUNCE_RESPONSE 279 #define OPENTHREAD_CONFIG_MLE_SEND_UNICAST_ANNOUNCE_RESPONSE 1 280 #endif 281 282 /** 283 * @def OPENTHREAD_CONFIG_MLE_INFORM_PREVIOUS_PARENT_ON_REATTACH 284 * 285 * Define as 1 for a child to inform its previous parent when it attaches to a new parent. 286 * 287 * If this feature is enabled, when a device attaches to a new parent, it will send an IP message (with empty payload 288 * and mesh-local IP address as the source address) to its previous parent. 289 */ 290 #ifndef OPENTHREAD_CONFIG_MLE_INFORM_PREVIOUS_PARENT_ON_REATTACH 291 #define OPENTHREAD_CONFIG_MLE_INFORM_PREVIOUS_PARENT_ON_REATTACH 1 292 #endif 293 294 /** 295 * @def OPENTHREAD_CONFIG_MLE_PARENT_RESPONSE_CALLBACK_API_ENABLE 296 * 297 * Define as 1 to support `otThreadRegisterParentResponseCallback()` API which registers a callback to notify user 298 * of received Parent Response message(s) during attach. This API is mainly intended for debugging and therefore is 299 * disabled by default. 300 */ 301 #ifndef OPENTHREAD_CONFIG_MLE_PARENT_RESPONSE_CALLBACK_API_ENABLE 302 #define OPENTHREAD_CONFIG_MLE_PARENT_RESPONSE_CALLBACK_API_ENABLE 0 303 #endif 304 305 /** 306 * @def OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE 307 * 308 * Define as 1 to enable Link Metrics initiator feature. 309 */ 310 #ifndef OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE 311 #define OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE 0 312 #endif 313 314 /** 315 * @def OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE 316 * 317 * Define as 1 to enable Link Metrics subject feature. 318 */ 319 #ifndef OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE 320 #define OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE 0 321 #endif 322 323 /** 324 * @def OPENTHREAD_CONFIG_MLE_LINK_METRICS_MAX_SERIES_SUPPORTED 325 * 326 * The max number of series that a Link Metrics Subject can track simultaneously. 327 */ 328 #ifndef OPENTHREAD_CONFIG_MLE_LINK_METRICS_MAX_SERIES_SUPPORTED 329 #define OPENTHREAD_CONFIG_MLE_LINK_METRICS_MAX_SERIES_SUPPORTED OPENTHREAD_CONFIG_MLE_MAX_CHILDREN 330 #endif 331 332 /** 333 * @def OPENTHREAD_CONFIG_MLE_LINK_METRICS_SERIES_MTD 334 * 335 * The max number of series that a Link Metrics Subject (MTD device) can track simultaneously. 336 */ 337 #ifndef OPENTHREAD_CONFIG_MLE_LINK_METRICS_SERIES_MTD 338 #define OPENTHREAD_CONFIG_MLE_LINK_METRICS_SERIES_MTD 2 339 #endif 340 341 /** 342 * @def OPENTHREAD_CONFIG_DYNAMIC_STORE_FRAME_AHEAD_COUNTER_ENABLE 343 * 344 * Enable setting the store frame counter ahead. 345 */ 346 #ifndef OPENTHREAD_CONFIG_DYNAMIC_STORE_FRAME_AHEAD_COUNTER_ENABLE 347 #define OPENTHREAD_CONFIG_DYNAMIC_STORE_FRAME_AHEAD_COUNTER_ENABLE 0 348 #endif 349 350 /** 351 * @} 352 */ 353 354 #endif // CONFIG_MLE_H_ 355