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