1 /* 2 * Copyright (c) 2016-2023, 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 Mesh Forwarder. 32 */ 33 34 #ifndef CONFIG_MESH_FORWARDER_H_ 35 #define CONFIG_MESH_FORWARDER_H_ 36 37 /** 38 * @addtogroup config-mesh-forwarder 39 * 40 * @brief 41 * This module includes configuration variables for the Mesh Forwarder. 42 * 43 * @{ 44 */ 45 46 #include "config/border_router.h" 47 48 /** 49 * @def OPENTHREAD_CONFIG_DROP_MESSAGE_ON_FRAGMENT_TX_FAILURE 50 * 51 * Define as 1 for OpenThread to drop a message (and not send any remaining fragments of the message) if all transmit 52 * attempts fail for a fragment of the message. For a direct transmission, a failure occurs after all MAC transmission 53 * attempts for a given fragment are unsuccessful. For an indirect transmission, a failure occurs after all data poll 54 * triggered transmission attempts for a given fragment fail. 55 * 56 * If set to zero (disabled), OpenThread will attempt to send subsequent fragments, whether or not all transmission 57 * attempts fail for a given fragment. 58 */ 59 #ifndef OPENTHREAD_CONFIG_DROP_MESSAGE_ON_FRAGMENT_TX_FAILURE 60 #define OPENTHREAD_CONFIG_DROP_MESSAGE_ON_FRAGMENT_TX_FAILURE 1 61 #endif 62 63 /** 64 * @def OPENTHREAD_CONFIG_6LOWPAN_REASSEMBLY_TIMEOUT 65 * 66 * The reassembly timeout between 6LoWPAN fragments in seconds. 67 */ 68 #ifndef OPENTHREAD_CONFIG_6LOWPAN_REASSEMBLY_TIMEOUT 69 #define OPENTHREAD_CONFIG_6LOWPAN_REASSEMBLY_TIMEOUT 2 70 #endif 71 72 /** 73 * @def OPENTHREAD_CONFIG_NUM_FRAGMENT_PRIORITY_ENTRIES 74 * 75 * The number of fragment priority entries. 76 */ 77 #ifndef OPENTHREAD_CONFIG_NUM_FRAGMENT_PRIORITY_ENTRIES 78 #define OPENTHREAD_CONFIG_NUM_FRAGMENT_PRIORITY_ENTRIES 8 79 #endif 80 81 /** 82 * @def OPENTHREAD_CONFIG_DELAY_AWARE_QUEUE_MANAGEMENT_ENABLE 83 * 84 * Define to 1 to enable delay-aware queue management for the send queue. 85 * 86 * When enabled device will monitor time-in-queue of messages in the direct tx queue and if the wait time is lager than 87 * specified thresholds it may update ECN flag (if message indicates it is ECN-capable) or drop the message. 88 */ 89 #ifndef OPENTHREAD_CONFIG_DELAY_AWARE_QUEUE_MANAGEMENT_ENABLE 90 #define OPENTHREAD_CONFIG_DELAY_AWARE_QUEUE_MANAGEMENT_ENABLE \ 91 (OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_3) 92 #endif 93 94 /** 95 * @OPENTHREAD_CONFIG_DELAY_AWARE_QUEUE_MANAGEMENT_MARK_ECN_INTERVAL 96 * 97 * Specifies the time-in-queue threshold interval in milliseconds to mark ECN on a message if it is ECN-capable or 98 * drop the message if not ECN-capable. 99 */ 100 #ifndef OPENTHREAD_CONFIG_DELAY_AWARE_QUEUE_MANAGEMENT_MARK_ECN_INTERVAL 101 #define OPENTHREAD_CONFIG_DELAY_AWARE_QUEUE_MANAGEMENT_MARK_ECN_INTERVAL 500 102 #endif 103 104 /** 105 * @OPENTHREAD_CONFIG_DELAY_AWARE_QUEUE_MANAGEMENT_DROP_MSG_INTERVAL 106 * 107 * Specifies the time-in-queue threshold interval in milliseconds to drop a message. 108 */ 109 #ifndef OPENTHREAD_CONFIG_DELAY_AWARE_QUEUE_MANAGEMENT_DROP_MSG_INTERVAL 110 #define OPENTHREAD_CONFIG_DELAY_AWARE_QUEUE_MANAGEMENT_DROP_MSG_INTERVAL 1000 111 #endif 112 113 /** 114 * OPENTHREAD_CONFIG_DELAY_AWARE_QUEUE_MANAGEMENT_FRAG_TAG_RETAIN_TIME 115 * 116 * Specifies the max retain time in seconds of a mesh header fragmentation tag entry in the list. 117 * 118 * The entry in list is used to track whether an earlier fragment of same message was dropped by the router and if so 119 * the next fragments are also dropped. The entry is removed once last fragment is processed or after the retain time 120 * specified by this config parameter expires. 121 */ 122 #ifndef OPENTHREAD_CONFIG_DELAY_AWARE_QUEUE_MANAGEMENT_FRAG_TAG_RETAIN_TIME 123 #define OPENTHREAD_CONFIG_DELAY_AWARE_QUEUE_MANAGEMENT_FRAG_TAG_RETAIN_TIME (4 * 60) // 4 minutes 124 #endif 125 126 /** 127 * OPENTHREAD_CONFIG_DELAY_AWARE_QUEUE_MANAGEMENT_FRAG_TAG_ENTRY_LIST_SIZE 128 * 129 * Specifies the number of mesh header fragmentation tag entries in the list for delay-aware queue management. 130 * 131 * The list is used to track whether an earlier fragment of same message was dropped by the router and if so the next 132 * fragments are also dropped. 133 */ 134 #ifndef OPENTHREAD_CONFIG_DELAY_AWARE_QUEUE_MANAGEMENT_FRAG_TAG_ENTRY_LIST_SIZE 135 #define OPENTHREAD_CONFIG_DELAY_AWARE_QUEUE_MANAGEMENT_FRAG_TAG_ENTRY_LIST_SIZE 16 136 #endif 137 138 /** 139 * @def OPENTHREAD_CONFIG_MAX_FRAMES_IN_DIRECT_TX_QUEUE 140 * 141 * Specifies the maximum number of frames in direct tx queue before new direct tx messages are dropped. 142 * 143 * If set to zero then the behavior is disabled, i.e., no check is performed on tx queue length. 144 */ 145 #ifndef OPENTHREAD_CONFIG_MAX_FRAMES_IN_DIRECT_TX_QUEUE 146 #if (OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_3) 147 #define OPENTHREAD_CONFIG_MAX_FRAMES_IN_DIRECT_TX_QUEUE 100 148 #else 149 #define OPENTHREAD_CONFIG_MAX_FRAMES_IN_DIRECT_TX_QUEUE 0 150 #endif 151 #endif 152 153 /** 154 * @def OPENTHREAD_CONFIG_TX_QUEUE_STATISTICS_ENABLE 155 * 156 * Define as 1 to enable TX queue time-in-queue statistics collection feature. 157 * 158 * When enabled, histogram of the time-in-queue of messages in the transmit queue is collected. The time-in-queue is 159 * tracked for direct transmissions only and is measured as the duration from when a message is added to the transmit 160 * queue until it is passed to the MAC layer for transmission or dropped. 161 * 162 * The histogram data consists of number of bins, each representing a range of time-in-queue values. The bin interval 163 * length is specified by the `OPENTHREAD_CONFIG_TX_QUEUE_STATISTICS_HISTOGRAM_BIN_INTERVAL` configuration, and the 164 * maximum tracked interval is given by the `OPENTHREAD_CONFIG_TX_QUEUE_STATISTICS_HISTOGRAM_MAX_INTERVAL`. 165 * 166 * Along with histogram, the maximum observed time-in-queue is also tracked. 167 */ 168 #ifndef OPENTHREAD_CONFIG_TX_QUEUE_STATISTICS_ENABLE 169 #define OPENTHREAD_CONFIG_TX_QUEUE_STATISTICS_ENABLE (OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE && OPENTHREAD_FTD) 170 #endif 171 172 /** 173 * @def OPENTHREAD_CONFIG_TX_QUEUE_STATISTICS_HISTOGRAM_MAX_INTERVAL 174 * 175 * Specifies the maximum time-in-queue interval in milliseconds tracked by the histogram when the TX queue time-in-queue 176 * statistics collection feature is enabled. 177 * 178 * By default the `OPENTHREAD_CONFIG_DELAY_AWARE_QUEUE_MANAGEMENT_MARK_ECN_INTERVAL` is used which defines the 179 * maximum time-in-queue interval after which a non-ECN capable message is dropped by delay-aware queue management 180 * feature. 181 */ 182 #ifndef OPENTHREAD_CONFIG_TX_QUEUE_STATISTICS_HISTOGRAM_MAX_INTERVAL 183 #define OPENTHREAD_CONFIG_TX_QUEUE_STATISTICS_HISTOGRAM_MAX_INTERVAL \ 184 OPENTHREAD_CONFIG_DELAY_AWARE_QUEUE_MANAGEMENT_MARK_ECN_INTERVAL 185 #endif 186 187 /** 188 * @def OPENTHREAD_CONFIG_TX_QUEUE_STATISTICS_HISTOGRAM_BIN_INTERVAL 189 * 190 * Specifies the time-in-queue histogram bin interval in milliseconds when the TX queue time-in-queue statistics 191 * collection feature is enabled. 192 * 193 * The number of bins is calculated by dividing `OPENTHREAD_CONFIG_TX_QUEUE_STATISTICS_HISTOGRAM_MAX_INTERVAL` by 194 * `OPENTHREAD_CONFIG_TX_QUEUE_STATISTICS_HISTOGRAM_BIN_INTERVAL` and rounding up to the nearest integer. 195 */ 196 #ifndef OPENTHREAD_CONFIG_TX_QUEUE_STATISTICS_HISTOGRAM_BIN_INTERVAL 197 #define OPENTHREAD_CONFIG_TX_QUEUE_STATISTICS_HISTOGRAM_BIN_INTERVAL 10 198 #endif 199 200 /** 201 * @} 202 */ 203 204 #endif // CONFIG_MESH_FORWARDER_H_ 205