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 Channel Manager. 32 * 33 */ 34 35 #ifndef CONFIG_CHANNEL_MANAGER_H_ 36 #define CONFIG_CHANNEL_MANAGER_H_ 37 38 /** 39 * @def OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE 40 * 41 * Define as 1 to enable Channel Manager support. 42 * 43 */ 44 #ifndef OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE 45 #define OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE 0 46 #endif 47 48 /** 49 * @def OPENTHREAD_CONFIG_CHANNEL_MANAGER_MINIMUM_DELAY 50 * 51 * The minimum delay (in seconds) used by Channel Manager module for performing a channel change. 52 * 53 * The minimum delay should preferably be longer than maximum data poll interval used by all sleepy-end-devices within 54 * the Thread network. 55 * 56 * Applicable only if Channel Manager feature is enabled (i.e., `OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE` is set). 57 * 58 */ 59 #ifndef OPENTHREAD_CONFIG_CHANNEL_MANAGER_MINIMUM_DELAY 60 #define OPENTHREAD_CONFIG_CHANNEL_MANAGER_MINIMUM_DELAY 120 61 #endif 62 63 /** 64 * @def OPENTHREAD_CONFIG_CHANNEL_MANAGER_MINIMUM_MONITOR_SAMPLE_COUNT 65 * 66 * The minimum number of RSSI samples per channel by Channel Monitoring feature before the collected data can be used 67 * by the Channel Manager module to (auto) select a better channel. 68 * 69 * Applicable only if Channel Manager and Channel Monitoring features are both enabled (i.e., 70 * `OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE` and `OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE` are set). 71 * 72 */ 73 #ifndef OPENTHREAD_CONFIG_CHANNEL_MANAGER_MINIMUM_MONITOR_SAMPLE_COUNT 74 #define OPENTHREAD_CONFIG_CHANNEL_MANAGER_MINIMUM_MONITOR_SAMPLE_COUNT 500 75 #endif 76 77 /** 78 * @def OPENTHREAD_CONFIG_CHANNEL_MANAGER_THRESHOLD_TO_SKIP_FAVORED 79 * 80 * This threshold specifies the minimum occupancy rate difference between two channels for the Channel Manager to 81 * prefer an unfavored channel over the best favored one. This is used when (auto) selecting a channel based on the 82 * collected channel quality data by "channel monitor" feature. 83 * 84 * The difference is based on the `ChannelMonitor::GetChannelOccupancy()` definition which provides the average 85 * percentage of RSSI samples (within a time window) indicating that channel was busy (i.e., RSSI value higher than 86 * a threshold). Value 0 maps to 0% and 0xffff maps to 100%. 87 * 88 * Applicable only if Channel Manager feature is enabled (i.e., `OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE` is set). 89 * 90 */ 91 #ifndef OPENTHREAD_CONFIG_CHANNEL_MANAGER_THRESHOLD_TO_SKIP_FAVORED 92 #define OPENTHREAD_CONFIG_CHANNEL_MANAGER_THRESHOLD_TO_SKIP_FAVORED (0xffff * 7 / 100) 93 #endif 94 95 /** 96 * @def OPENTHREAD_CONFIG_CHANNEL_MANAGER_THRESHOLD_TO_CHANGE_CHANNEL 97 * 98 * This threshold specifies the minimum occupancy rate difference required between the current channel and a newly 99 * selected channel for Channel Manager to allow channel change to the new channel. 100 * 101 * The difference is based on the `ChannelMonitor::GetChannelOccupancy()` definition which provides the average 102 * percentage of RSSI samples (within a time window) indicating that channel was busy (i.e., RSSI value higher than 103 * a threshold). Value 0 maps to 0% rate and 0xffff maps to 100%. 104 * 105 * Applicable only if Channel Manager feature is enabled (i.e., `OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE` is set). 106 * 107 */ 108 #ifndef OPENTHREAD_CONFIG_CHANNEL_MANAGER_THRESHOLD_TO_CHANGE_CHANNEL 109 #define OPENTHREAD_CONFIG_CHANNEL_MANAGER_THRESHOLD_TO_CHANGE_CHANNEL (0xffff * 10 / 100) 110 #endif 111 112 /** 113 * @def OPENTHREAD_CONFIG_CHANNEL_MANAGER_DEFAULT_AUTO_SELECT_INTERVAL 114 * 115 * The default time interval (in seconds) used by Channel Manager for auto-channel-selection functionality. 116 * 117 * Applicable only if Channel Manager feature is enabled (i.e., `OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE` is set). 118 * 119 */ 120 #ifndef OPENTHREAD_CONFIG_CHANNEL_MANAGER_DEFAULT_AUTO_SELECT_INTERVAL 121 #define OPENTHREAD_CONFIG_CHANNEL_MANAGER_DEFAULT_AUTO_SELECT_INTERVAL (3 * 60 * 60) 122 #endif 123 124 /** 125 * @def OPENTHREAD_CONFIG_CHANNEL_MANAGER_CCA_FAILURE_THRESHOLD 126 * 127 * Default minimum CCA failure rate threshold on current channel before Channel Manager starts channel selection 128 * attempt. 129 * 130 * Value 0 maps to 0% and 0xffff maps to 100%. 131 * 132 * Applicable only if Channel Manager feature is enabled (i.e., `OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE` is set). 133 * 134 */ 135 #ifndef OPENTHREAD_CONFIG_CHANNEL_MANAGER_CCA_FAILURE_THRESHOLD 136 #define OPENTHREAD_CONFIG_CHANNEL_MANAGER_CCA_FAILURE_THRESHOLD (0xffff * 14 / 100) 137 #endif 138 139 #endif // CONFIG_CHANNEL_MANAGER_H_ 140