# MLE Service

This module includes configuration variables for the MLE service.

## Summary

| ### Macros ||
|---|---|
| `https://openthread.io/reference/config/group/config-mle#group__config-mle_1ga7b3e9f698bf08ee3a0b7ce490d0c3acb 0` | Enable setting the store frame counter ahead. |
| `https://openthread.io/reference/config/group/config-mle#group__config-mle_1ga8753abe33bb0c1a53bb0dca05f1bb86a 20000` | Specifies the delay wait interval (in milliseconds) used by attach backoff feature after a successful attach before it resets the current backoff interval back to the minimum value. |
| `https://openthread.io/reference/config/group/config-mle#group__config-mle_1gaa854ba3e751b2d9281ba4fb46cacc929 1` | Define as 1 to enable attach backoff feature. |
| `https://openthread.io/reference/config/group/config-mle#group__config-mle_1ga9edd16dd0fdfba7fdbeefeb0746d3c41 2000` | Specifies the maximum jitter interval (in milliseconds) used by attach backoff feature. |
| `https://openthread.io/reference/config/group/config-mle#group__config-mle_1ga7ab08f5f68b020fd62dccadba543c026 1200000` | Specifies the maximum backoff wait interval (in milliseconds) used by attach backoff feature. |
| `https://openthread.io/reference/config/group/config-mle#group__config-mle_1gadcee61d1c10c0f77a6af5890256cfcc7 251` | Specifies the minimum backoff wait interval (in milliseconds) used by attach backoff feature. |
| `https://openthread.io/reference/config/group/config-mle#group__config-mle_1ga518d9d33d89c7d2a22121df5a9937b02 3` | Specifies the desired number of router links that a REED / FED attempts to maintain. |
| `https://openthread.io/reference/config/group/config-mle#group__config-mle_1ga394fba6024695d6e7db19168d1db4579 240` | The default child timeout value (in seconds). |
| `https://openthread.io/reference/config/group/config-mle#group__config-mle_1gabec966afd9b5282ad45a2aeb57b83eac 0` | Specifies the default value for `mLeaderWeightAdjustment` in `otDeviceProperties`. |
| `https://openthread.io/reference/config/group/config-mle#group__config-mle_1ga3073b00771910492e201923d56f9ead2 (OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_4)` | Define as 1 to enable feature to set device properties which are used for calculating the local leader weight on a device. |
| `https://openthread.io/reference/config/group/config-mle#group__config-mle_1ga2d96f18b0f2aae796151d525d687ae8c 0` | Define as 1 to support `otThreadSetDiscoveryRequestCallback()`. |
| `https://openthread.io/reference/config/group/config-mle#group__config-mle_1gac0da6f604a38059d3760d5a23a5a8115 32` | Specifies the extra router links in addition to those specified by `otThreadSetChildRouterLinks()` that an FTD child can try to establish gradually over a longer span of time. |
| `https://openthread.io/reference/config/group/config-mle#group__config-mle_1gaced8efacb8d94fffe0fae41fa41225a3 1` | Define as 1 for a child to inform its previous parent when it attaches to a new parent. |
| `https://openthread.io/reference/config/group/config-mle#group__config-mle_1ga772523840ebc6270681fb2233ed84bf0 4` | The maximum number of supported IPv6 address registrations per child. |
| `https://openthread.io/reference/config/group/config-mle#group__config-mle_1gaa32004d31d357ee55ca616a8d477a484 0` | Define as 1 to enable Link Metrics initiator feature. |
| `https://openthread.io/reference/config/group/config-mle#group__config-mle_1gad8973794e36626f673758992eda02548 OPENTHREAD_CONFIG_MLE_MAX_CHILDREN` | The max number of series that a Link Metrics Subject can track simultaneously. |
| `https://openthread.io/reference/config/group/config-mle#group__config-mle_1ga1a178c25c4a6f0da05bffca46a2f0adf 2` | The max number of series that a Link Metrics Subject (MTD device) can track simultaneously. |
| `https://openthread.io/reference/config/group/config-mle#group__config-mle_1gae9d8c90f76de71efc72476743828603d 0` | Define as 1 to enable Link Metrics subject feature. |
| `https://openthread.io/reference/config/group/config-mle#group__config-mle_1ga22eb477456f7216930422004a1d338e5 10` | Specifies the minimum link margin in dBm required before attempting to establish a link with a neighboring router. |
| `https://openthread.io/reference/config/group/config-mle#group__config-mle_1ga463baf51e2e9757f76d34f995c7fbbf7 0` | Enable experimental mode for 'deep' networks, allowing packet routes up to 32 nodes. |
| `https://openthread.io/reference/config/group/config-mle#group__config-mle_1ga91f57a0312828469e73f0c035525f40f 10` | The maximum number of children. |
| `https://openthread.io/reference/config/group/config-mle#group__config-mle_1gaa170978ca449b8777a9bfb8a627a036d 32` | The maximum number of routers in a Thread network. |
| `https://openthread.io/reference/config/group/config-mle#group__config-mle_1ga0a81f5a5ce28db7eb6198a6cb25d386a 0` | Define as 1 to support `otThreadRegisterParentResponseCallback()` API which registers a callback to notify user of received Parent Response message(s) during attach. |
| `https://openthread.io/reference/config/group/config-mle#group__config-mle_1gac39cbc8844d302a3aeb6c6cd98ac48a7 10` | Specifies the minimum link margin in dBm required before attempting to merge to a different partition. |
| `https://openthread.io/reference/config/group/config-mle#group__config-mle_1gacf7b1ea815690db38958fde12efef1ff 1` | Define as 1 to enable sending of a unicast MLE Announce message in response to a received Announce message from a device. |
| `https://openthread.io/reference/config/group/config-mle#group__config-mle_1ga28aae785dfd537f2d4ccac3aed3ff1a4 0` | Enable setting steering data out of band. |

## Macros

### OPENTHREAD_CONFIG_DYNAMIC_STORE_FRAME_AHEAD_COUNTER_ENABLE

```
 OPENTHREAD_CONFIG_DYNAMIC_STORE_FRAME_AHEAD_COUNTER_ENABLE 0
```
Enable setting the store frame counter ahead.

### OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_DELAY_TO_RESET_BACKOFF_INTERVAL

```
 OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_DELAY_TO_RESET_BACKOFF_INTERVAL 20000
```
Specifies the delay wait interval (in milliseconds) used by attach backoff feature after a successful attach before it resets the current backoff interval back to the minimum value.

If it is set to zero then the device resets its backoff attach interval immediately after a successful attach. With a non-zero value, if after a successful attach, the device happens to detach within the delay interval, the reattach process resumes with the previous backoff interval (as if the attach did not happen).

This behavior is helpful in the situation where a battery-powered device has poor link quality to its parent and therefore attaches and detaches frequently from the parent. Using a non-zero wait interval ensures that the attach backoff interval does not reset on each attach and that the device does not drain its battery quickly trying to re-attach too frequently.

### OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_ENABLE

```
 OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_ENABLE 1
```
Define as 1 to enable attach backoff feature.

When this feature is enabled, an exponentially increasing backoff wait time is added between attach attempts. If device is sleepy, the radio will be put to sleep during the wait time. This ensures that a battery-powered sleepy end-device does not drain its battery by continuously searching for a parent to attach to (when there is no router/parent for it to attach).

The backoff time starts from a minimum interval specified by `OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_MINIMUM_INTERVAL`, and every attach attempt the wait time is doubled up to `OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_MAXIMUM_INTERVAL` which specifies the maximum wait time.

Once the wait time reaches the maximum, a random jitter interval is added to it. The maximum value for jitter is specified by `OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_JITTER_INTERVAL`. The random jitter is selected uniformly within range `[-JITTER, +JITTER]`. It is only added when the backoff wait interval is at maximum value.

### OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_JITTER_INTERVAL

```
 OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_JITTER_INTERVAL 2000
```
Specifies the maximum jitter interval (in milliseconds) used by attach backoff feature.

Applicable only if attach backoff feature is enabled (see `OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_ENABLE`).

Please see `OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_ENABLE` description for more details.

### OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_MAXIMUM_INTERVAL

```
 OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_MAXIMUM_INTERVAL 1200000
```
Specifies the maximum backoff wait interval (in milliseconds) used by attach backoff feature.

Applicable only if attach backoff feature is enabled (see `OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_ENABLE`).

Please see `OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_ENABLE` description for more details.

### OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_MINIMUM_INTERVAL

```
 OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_MINIMUM_INTERVAL 251
```
Specifies the minimum backoff wait interval (in milliseconds) used by attach backoff feature.

Applicable only if attach backoff feature is enabled (see `OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_ENABLE`).

Please see `OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_ENABLE` description for more details.

### OPENTHREAD_CONFIG_MLE_CHILD_ROUTER_LINKS

```
 OPENTHREAD_CONFIG_MLE_CHILD_ROUTER_LINKS 3
```
Specifies the desired number of router links that a REED / FED attempts to maintain.

This is default value used on an FTD child. This parameter can also be changed at run-time using the public APIs `otThreadGetChildRouterLinks/otThreadSetChildRouterLinks()`.

### OPENTHREAD_CONFIG_MLE_CHILD_TIMEOUT_DEFAULT

```
 OPENTHREAD_CONFIG_MLE_CHILD_TIMEOUT_DEFAULT 240
```
The default child timeout value (in seconds).

### OPENTHREAD_CONFIG_MLE_DEFAULT_LEADER_WEIGHT_ADJUSTMENT

```
 OPENTHREAD_CONFIG_MLE_DEFAULT_LEADER_WEIGHT_ADJUSTMENT 0
```
Specifies the default value for `mLeaderWeightAdjustment` in `otDeviceProperties`.

MUST be from -16 up to +16.

This value is used to adjust the calculated Leader Weight from `otDeviceProperties`.

### OPENTHREAD_CONFIG_MLE_DEVICE_PROPERTY_LEADER_WEIGHT_ENABLE

```
 OPENTHREAD_CONFIG_MLE_DEVICE_PROPERTY_LEADER_WEIGHT_ENABLE (OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_4)
```
Define as 1 to enable feature to set device properties which are used for calculating the local leader weight on a device.

It is enabled by default on Thread Version 1.4 or later.

### OPENTHREAD_CONFIG_MLE_DISCOVERY_SCAN_REQUEST_CALLBACK_ENABLE

```
 OPENTHREAD_CONFIG_MLE_DISCOVERY_SCAN_REQUEST_CALLBACK_ENABLE 0
```
Define as 1 to support `otThreadSetDiscoveryRequestCallback()`.

It allows registering a callback to be notified of received MLE Discovery Requests.

### OPENTHREAD_CONFIG_MLE_EXTRA_CHILD_ROUTER_LINKS_GRADUAL

```
 OPENTHREAD_CONFIG_MLE_EXTRA_CHILD_ROUTER_LINKS_GRADUAL 32
```
Specifies the extra router links in addition to those specified by `otThreadSetChildRouterLinks()` that an FTD child can try to establish gradually over a longer span of time.

A child device communicates through its parent but can establish links with other neighboring routers so that it can receive multicast messages (forwarded MPL) from other routers, thus improving multicast reliability.

An FTD child tries to establish links with the first `CHILD_ROUTER_LINK` routers as quickly as possible (sending MLE Link Request to initiate link upon receiving advertisements from a neighboring router).

After that, the FTD child uses the "gradual router link establishment" mechanism to establish router links with `OPENTHREAD_CONFIG_MLE_EXTRA_CHILD_ROUTER_LINKS_GRADUAL` additional routers. This is done slowly and over a longer span of time.

This parameter can be set to zero to disable "gradual router link establishment" fully. Alternatively, it can be set to the maximum router count of 32 to allow the FTD child to establish links with all neighboring routers.

### OPENTHREAD_CONFIG_MLE_INFORM_PREVIOUS_PARENT_ON_REATTACH

```
 OPENTHREAD_CONFIG_MLE_INFORM_PREVIOUS_PARENT_ON_REATTACH 1
```
Define as 1 for a child to inform its previous parent when it attaches to a new parent.

If this feature is enabled, when a device attaches to a new parent, it will send an IP message (with empty payload and mesh-local IP address as the source address) to its previous parent.

### OPENTHREAD_CONFIG_MLE_IP_ADDRS_PER_CHILD

```
 OPENTHREAD_CONFIG_MLE_IP_ADDRS_PER_CHILD 4
```
The maximum number of supported IPv6 address registrations per child.

By default, this is set to 16 when `OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE` is enabled, and 4 otherwise.

### OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE

```
 OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE 0
```
Define as 1 to enable Link Metrics initiator feature.

### OPENTHREAD_CONFIG_MLE_LINK_METRICS_MAX_SERIES_SUPPORTED

```
 OPENTHREAD_CONFIG_MLE_LINK_METRICS_MAX_SERIES_SUPPORTED OPENTHREAD_CONFIG_MLE_MAX_CHILDREN
```
The max number of series that a Link Metrics Subject can track simultaneously.

### OPENTHREAD_CONFIG_MLE_LINK_METRICS_SERIES_MTD

```
 OPENTHREAD_CONFIG_MLE_LINK_METRICS_SERIES_MTD 2
```
The max number of series that a Link Metrics Subject (MTD device) can track simultaneously.

### OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE

```
 OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE 0
```
Define as 1 to enable Link Metrics subject feature.

### OPENTHREAD_CONFIG_MLE_LINK_REQUEST_MARGIN_MIN

```
 OPENTHREAD_CONFIG_MLE_LINK_REQUEST_MARGIN_MIN 10
```
Specifies the minimum link margin in dBm required before attempting to establish a link with a neighboring router.

### OPENTHREAD_CONFIG_MLE_LONG_ROUTES_ENABLE

```
 OPENTHREAD_CONFIG_MLE_LONG_ROUTES_ENABLE 0
```
Enable experimental mode for 'deep' networks, allowing packet routes up to 32 nodes.

This mode is incompatible with Thread 1.1.1 and older.

### OPENTHREAD_CONFIG_MLE_MAX_CHILDREN

```
 OPENTHREAD_CONFIG_MLE_MAX_CHILDREN 10
```
The maximum number of children.

By default, this is set to 64 when `OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE` is enabled, and 10 otherwise.

### OPENTHREAD_CONFIG_MLE_MAX_ROUTERS

```
 OPENTHREAD_CONFIG_MLE_MAX_ROUTERS 32
```
The maximum number of routers in a Thread network.


> [!NOTE]
> **Note:** Thread specifies this value to be 32. Changing this value may cause interoperability issues with standard Thread 1.1 devices.

<br />

### OPENTHREAD_CONFIG_MLE_PARENT_RESPONSE_CALLBACK_API_ENABLE

```
 OPENTHREAD_CONFIG_MLE_PARENT_RESPONSE_CALLBACK_API_ENABLE 0
```
Define as 1 to support `otThreadRegisterParentResponseCallback()` API which registers a callback to notify user of received Parent Response message(s) during attach.

This API is mainly intended for debugging and therefore is disabled by default.

### OPENTHREAD_CONFIG_MLE_PARTITION_MERGE_MARGIN_MIN

```
 OPENTHREAD_CONFIG_MLE_PARTITION_MERGE_MARGIN_MIN 10
```
Specifies the minimum link margin in dBm required before attempting to merge to a different partition.

### OPENTHREAD_CONFIG_MLE_SEND_UNICAST_ANNOUNCE_RESPONSE

```
 OPENTHREAD_CONFIG_MLE_SEND_UNICAST_ANNOUNCE_RESPONSE 1
```
Define as 1 to enable sending of a unicast MLE Announce message in response to a received Announce message from a device.


> [!NOTE]
> **Note:** The unicast MLE announce message is sent in addition to (and after) the multicast MLE Announce.

<br />

### OPENTHREAD_CONFIG_MLE_STEERING_DATA_SET_OOB_ENABLE

```
 OPENTHREAD_CONFIG_MLE_STEERING_DATA_SET_OOB_ENABLE 0
```
Enable setting steering data out of band.

## Resources

OpenThread API Reference topics originate from the source code, available
on [GitHub](https://github.com/openthread/openthread/tree/main/include/openthread).
For more information, or to contribute to our documentation, refer to
[Resources](https://openthread.io/resources).