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 35 #ifndef CONFIG_MLE_H_ 36 #define CONFIG_MLE_H_ 37 38 /** 39 * @addtogroup config-mle 40 * 41 * @brief 42 * This module includes configuration variables for the MLE service. 43 * 44 * @{ 45 * 46 */ 47 48 /** 49 * @def OPENTHREAD_CONFIG_MLE_MAX_ROUTERS 50 * 51 * The maximum number of routers in a Thread network. 52 * 53 * @note Thread specifies this value to be 32. Changing this value may cause interoperability issues with standard 54 * Thread 1.1 devices. 55 * 56 */ 57 #ifndef OPENTHREAD_CONFIG_MLE_MAX_ROUTERS 58 #define OPENTHREAD_CONFIG_MLE_MAX_ROUTERS 32 59 #endif 60 61 /** 62 * @def OPENTHREAD_CONFIG_MLE_MAX_CHILDREN 63 * 64 * The maximum number of children. 65 * 66 */ 67 #ifndef OPENTHREAD_CONFIG_MLE_MAX_CHILDREN 68 #define OPENTHREAD_CONFIG_MLE_MAX_CHILDREN 10 69 #endif 70 71 /** 72 * @def OPENTHREAD_CONFIG_MLE_CHILD_TIMEOUT_DEFAULT 73 * 74 * The default child timeout value (in seconds). 75 * 76 */ 77 #ifndef OPENTHREAD_CONFIG_MLE_CHILD_TIMEOUT_DEFAULT 78 #define OPENTHREAD_CONFIG_MLE_CHILD_TIMEOUT_DEFAULT 240 79 #endif 80 81 /** 82 * @def OPENTHREAD_CONFIG_MLE_IP_ADDRS_PER_CHILD 83 * 84 * The maximum number of supported IPv6 address registrations per child. 85 * 86 */ 87 #ifndef OPENTHREAD_CONFIG_MLE_IP_ADDRS_PER_CHILD 88 #define OPENTHREAD_CONFIG_MLE_IP_ADDRS_PER_CHILD 4 89 #endif 90 91 /** 92 * @def OPENTHREAD_CONFIG_MLE_IP_ADDRS_TO_REGISTER 93 * 94 * The maximum number of IPv6 address registrations for MTD. 95 * 96 */ 97 #ifndef OPENTHREAD_CONFIG_MLE_IP_ADDRS_TO_REGISTER 98 #define OPENTHREAD_CONFIG_MLE_IP_ADDRS_TO_REGISTER (OPENTHREAD_CONFIG_MLE_IP_ADDRS_PER_CHILD) 99 #endif 100 101 /** 102 * @def OPENTHREAD_CONFIG_MLE_DEVICE_PROPERTY_LEADER_WEIGHT_ENABLE 103 * 104 * Define as 1 to enable feature to set device properties which are used for calculating the local leader weight on a 105 * device. 106 * 107 * It is enabled by default on Thread Version 1.3.1 or later. 108 * 109 */ 110 #ifndef OPENTHREAD_CONFIG_MLE_DEVICE_PROPERTY_LEADER_WEIGHT_ENABLE 111 #define OPENTHREAD_CONFIG_MLE_DEVICE_PROPERTY_LEADER_WEIGHT_ENABLE \ 112 (OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_3_1) 113 #endif 114 115 /** 116 * @def OPENTHREAD_CONFIG_MLE_DEFAULT_LEADER_WEIGHT_ADJUSTMENT 117 * 118 * Specifies the default value for `mLeaderWeightAdjustment` in `otDeviceProperties`. MUST be from -16 up to +16. 119 * 120 * This value is used to adjust the calculated Leader Weight from `otDeviceProperties`. 121 * 122 */ 123 #ifndef OPENTHREAD_CONFIG_MLE_DEFAULT_LEADER_WEIGHT_ADJUSTMENT 124 #define OPENTHREAD_CONFIG_MLE_DEFAULT_LEADER_WEIGHT_ADJUSTMENT 0 125 #endif 126 127 /** 128 * @def OPENTHREAD_CONFIG_MLE_STEERING_DATA_SET_OOB_ENABLE 129 * 130 * Enable setting steering data out of band. 131 * 132 */ 133 #ifndef OPENTHREAD_CONFIG_MLE_STEERING_DATA_SET_OOB_ENABLE 134 #define OPENTHREAD_CONFIG_MLE_STEERING_DATA_SET_OOB_ENABLE 0 135 #endif 136 137 /** 138 * @def OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_ENABLE 139 * 140 * Define as 1 to enable attach backoff feature 141 * 142 * When this feature is enabled, an exponentially increasing backoff wait time is added between attach attempts. 143 * If device is sleepy, the radio will be put to sleep during the wait time. This ensures that a battery-powered sleepy 144 * end-device does not drain its battery by continuously searching for a parent to attach to (when there is no 145 * router/parent for it to attach). 146 * 147 * The backoff time starts from a minimum interval specified by 148 * `OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_MINIMUM_INTERVAL`, and every attach attempt the wait time is doubled up to 149 * `OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_MAXIMUM_INTERVAL` which specifies the maximum wait time. 150 * 151 * Once the wait time reaches the maximum, a random jitter interval is added to it. The maximum value for jitter is 152 * specified by `OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_JITTER_INTERVAL`. The random jitter is selected uniformly within 153 * range `[-JITTER, +JITTER]`. It is only added when the backoff wait interval is at maximum value. 154 * 155 */ 156 #ifndef OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_ENABLE 157 #define OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_ENABLE 1 158 #endif 159 160 /** 161 * @def OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_MINIMUM_INTERVAL 162 * 163 * Specifies the minimum backoff wait interval (in milliseconds) used by attach backoff feature. 164 * 165 * Applicable only if attach backoff feature is enabled (see `OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_ENABLE`). 166 * 167 * Please see `OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_ENABLE` description for more details. 168 * 169 */ 170 #ifndef OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_MINIMUM_INTERVAL 171 #define OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_MINIMUM_INTERVAL 251 172 #endif 173 174 /** 175 * @def OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_MAXIMUM_INTERVAL 176 * 177 * Specifies the maximum backoff wait interval (in milliseconds) used by attach backoff feature. 178 * 179 * Applicable only if attach backoff feature is enabled (see `OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_ENABLE`). 180 * 181 * Please see `OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_ENABLE` description for more details. 182 * 183 */ 184 #ifndef OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_MAXIMUM_INTERVAL 185 #define OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_MAXIMUM_INTERVAL 1200000 // 1200 seconds = 20 minutes 186 #endif 187 188 /** 189 * @def OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_JITTER_INTERVAL 190 * 191 * Specifies the maximum jitter interval (in milliseconds) used by attach backoff feature. 192 * 193 * Applicable only if attach backoff feature is enabled (see `OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_ENABLE`). 194 * 195 * Please see `OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_ENABLE` description for more details. 196 * 197 */ 198 #ifndef OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_JITTER_INTERVAL 199 #define OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_JITTER_INTERVAL 2000 200 #endif 201 202 /** 203 * @def OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_DELAY_TO_RESET_BACKOFF_INTERVAL 204 * 205 * Specifies the delay wait interval (in milliseconds) used by attach backoff feature after a successful attach before 206 * it resets the current backoff interval back to the minimum value. 207 * 208 * If it is set to zero then the device resets its backoff attach interval immediately after a successful attach. With 209 * a non-zero value, if after a successful attach, the device happens to detach within the delay interval, the reattach 210 * process resumes with the previous backoff interval (as if the attach did not happen). 211 * 212 * This behavior is helpful in the situation where a battery-powered device has poor link quality to its parent and 213 * therefore attaches and detaches frequently from the parent. Using a non-zero wait interval ensures that the attach 214 * backoff interval does not reset on each attach and that the device does not drain its battery quickly trying to 215 * re-attach too frequently. 216 * 217 */ 218 #ifndef OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_DELAY_TO_RESET_BACKOFF_INTERVAL 219 #define OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_DELAY_TO_RESET_BACKOFF_INTERVAL 20000 220 #endif 221 222 /** 223 * @def OPENTHREAD_CONFIG_MLE_SEND_LINK_REQUEST_ON_ADV_TIMEOUT 224 * 225 * Define to 1 to send an MLE Link Request when MAX_NEIGHBOR_AGE is reached for a neighboring router. 226 * 227 */ 228 #ifndef OPENTHREAD_CONFIG_MLE_SEND_LINK_REQUEST_ON_ADV_TIMEOUT 229 #define OPENTHREAD_CONFIG_MLE_SEND_LINK_REQUEST_ON_ADV_TIMEOUT 1 230 #endif 231 232 /** 233 * @def OPENTHREAD_CONFIG_MLE_LINK_REQUEST_MARGIN_MIN 234 * 235 * Specifies the minimum link margin in dBm required before attempting to establish a link with a neighboring router. 236 * 237 */ 238 #ifndef OPENTHREAD_CONFIG_MLE_LINK_REQUEST_MARGIN_MIN 239 #define OPENTHREAD_CONFIG_MLE_LINK_REQUEST_MARGIN_MIN 10 240 #endif 241 242 /** 243 * @def OPENTHREAD_CONFIG_MLE_PARTITION_MERGE_MARGIN_MIN 244 * 245 * Specifies the minimum link margin in dBm required before attempting to merge to a different partition. 246 * 247 */ 248 #ifndef OPENTHREAD_CONFIG_MLE_PARTITION_MERGE_MARGIN_MIN 249 #define OPENTHREAD_CONFIG_MLE_PARTITION_MERGE_MARGIN_MIN 10 250 #endif 251 252 /** 253 * @def OPENTHREAD_CONFIG_MLE_CHILD_ROUTER_LINKS 254 * 255 * Specifies the desired number of router links that a REED / FED attempts to maintain. 256 * 257 */ 258 #ifndef OPENTHREAD_CONFIG_MLE_CHILD_ROUTER_LINKS 259 #define OPENTHREAD_CONFIG_MLE_CHILD_ROUTER_LINKS 3 260 #endif 261 262 /** 263 * @def OPENTHREAD_CONFIG_MLE_LONG_ROUTES_ENABLE 264 * 265 * Enable experimental mode for 'deep' networks, allowing packet routes up to 32 nodes. 266 * This mode is incompatible with Thread 1.1.1 and older. 267 * 268 */ 269 #ifndef OPENTHREAD_CONFIG_MLE_LONG_ROUTES_ENABLE 270 #define OPENTHREAD_CONFIG_MLE_LONG_ROUTES_ENABLE 0 271 #endif 272 273 /** 274 * @def OPENTHREAD_CONFIG_MLE_SEND_UNICAST_ANNOUNCE_RESPONSE 275 * 276 * Define as 1 to enable sending of a unicast MLE Announce message in response to a received Announce message from 277 * a device. 278 * 279 * @note The unicast MLE announce message is sent in addition to (and after) the multicast MLE Announce. 280 * 281 */ 282 #ifndef OPENTHREAD_CONFIG_MLE_SEND_UNICAST_ANNOUNCE_RESPONSE 283 #define OPENTHREAD_CONFIG_MLE_SEND_UNICAST_ANNOUNCE_RESPONSE 1 284 #endif 285 286 /** 287 * @def OPENTHREAD_CONFIG_MLE_INFORM_PREVIOUS_PARENT_ON_REATTACH 288 * 289 * Define as 1 for a child to inform its previous parent when it attaches to a new parent. 290 * 291 * If this feature is enabled, when a device attaches to a new parent, it will send an IP message (with empty payload 292 * and mesh-local IP address as the source address) to its previous parent. 293 * 294 */ 295 #ifndef OPENTHREAD_CONFIG_MLE_INFORM_PREVIOUS_PARENT_ON_REATTACH 296 #define OPENTHREAD_CONFIG_MLE_INFORM_PREVIOUS_PARENT_ON_REATTACH 1 297 #endif 298 299 /** 300 * @def OPENTHREAD_CONFIG_MLE_PARENT_RESPONSE_CALLBACK_API_ENABLE 301 * 302 * Define as 1 to support `otThreadRegisterParentResponseCallback()` API which registers a callback to notify user 303 * of received Parent Response message(s) during attach. This API is mainly intended for debugging and therefore is 304 * disabled by default. 305 * 306 */ 307 #ifndef OPENTHREAD_CONFIG_MLE_PARENT_RESPONSE_CALLBACK_API_ENABLE 308 #define OPENTHREAD_CONFIG_MLE_PARENT_RESPONSE_CALLBACK_API_ENABLE 0 309 #endif 310 311 /** 312 * @def OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE 313 * 314 * Define as 1 to enable Link Metrics initiator feature. 315 * 316 */ 317 #ifndef OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE 318 #define OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE 0 319 #endif 320 321 /** 322 * @def OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE 323 * 324 * Define as 1 to enable Link Metrics subject feature. 325 * 326 */ 327 #ifndef OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE 328 #define OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE 0 329 #endif 330 331 /** 332 * @def OPENTHREAD_CONFIG_MLE_LINK_METRICS_MAX_SERIES_SUPPORTED 333 * 334 * The max number of series that a Link Metrics Subject can track simultaneously. 335 * 336 */ 337 #ifndef OPENTHREAD_CONFIG_MLE_LINK_METRICS_MAX_SERIES_SUPPORTED 338 #define OPENTHREAD_CONFIG_MLE_LINK_METRICS_MAX_SERIES_SUPPORTED OPENTHREAD_CONFIG_MLE_MAX_CHILDREN 339 #endif 340 341 /** 342 * @def OPENTHREAD_CONFIG_MLE_LINK_METRICS_SERIES_MTD 343 * 344 * The max number of series that a Link Metrics Subject (MTD device) can track simultaneously. 345 * 346 */ 347 #ifndef OPENTHREAD_CONFIG_MLE_LINK_METRICS_SERIES_MTD 348 #define OPENTHREAD_CONFIG_MLE_LINK_METRICS_SERIES_MTD 2 349 #endif 350 351 /** 352 * @} 353 * 354 */ 355 356 #endif // CONFIG_MLE_H_ 357