diff --git a/src/core/Makefile.am b/src/core/Makefile.am index 395d0389f..d5c79b820 100644 --- a/src/core/Makefile.am +++ b/src/core/Makefile.am @@ -331,6 +331,7 @@ HEADERS_COMMON = \ config/dns_client.h \ config/ip6.h \ config/joiner.h \ + config/link_quality.h \ config/openthread-core-config-check.h \ config/openthread-core-default-config.h \ crypto/aes_ccm.hpp \ diff --git a/src/core/config/link_quality.h b/src/core/config/link_quality.h new file mode 100644 index 000000000..c5f2bc443 --- /dev/null +++ b/src/core/config/link_quality.h @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2019, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * This file includes compile-time configurations for the Link Quality service. + * + */ + +#ifndef CONFIG_LINK_QUALITY_H_ +#define CONFIG_LINK_QUALITY_H_ + +/** + * @def OPENTHREAD_CONFIG_CCA_FAILURE_RATE_AVERAGING_WINDOW + * + * OpenThread's MAC implementation maintains the average failure rate of CCA (Clear Channel Assessment) operation on + * frame transmissions. This value specifies the window (in terms of number of transmissions or samples) over which the + * average rate is maintained. Practically, the average value can be considered as the percentage of CCA failures in + * (approximately) last AVERAGING_WINDOW frame transmissions. + * + */ +#ifndef OPENTHREAD_CONFIG_CCA_FAILURE_RATE_AVERAGING_WINDOW +#define OPENTHREAD_CONFIG_CCA_FAILURE_RATE_AVERAGING_WINDOW 512 +#endif + +/** + * @def OPENTHREAD_CONFIG_ENABLE_TX_ERROR_RATE_TRACKING + * + * Define as 1 to enable transmission error rate tracking (for both MAC frames and IPv6 messages). + * + * When enabled, OpenThread will track average error rate of MAC frame transmissions and IPv6 message error rate for + * every neighbor. + * + */ +#ifndef OPENTHREAD_CONFIG_ENABLE_TX_ERROR_RATE_TRACKING +#define OPENTHREAD_CONFIG_ENABLE_TX_ERROR_RATE_TRACKING 1 +#endif + +/** + * @def OPENTHREAD_CONFIG_FRAME_TX_ERR_RATE_AVERAGING_WINDOW + * + * Applicable only if error rate tracking is enabled (i.e., `OPENTHREAD_CONFIG_ENABLE_TX_ERROR_RATE_TRACKING` is set). + * + * OpenThread's MAC implementation maintains the average error rate of MAC frame transmissions per neighbor. This + * parameter specifies the window (in terms of number of frames/sample) over which the average error rate is maintained. + * Practically, the average value can be considered as the percentage of failed (no ack) MAC frame transmissions over + * (approximately) last AVERAGING_WINDOW frame transmission attempts to a specific neighbor. + * + */ +#ifndef OPENTHREAD_CONFIG_FRAME_TX_ERR_RATE_AVERAGING_WINDOW +#define OPENTHREAD_CONFIG_FRAME_TX_ERR_RATE_AVERAGING_WINDOW 128 +#endif + +/** + * @def OPENTHREAD_CONFIG_IPV6_TX_ERR_RATE_AVERAGING_WINDOW + * + * Applicable only if error rate tracking is enabled (i.e., `OPENTHREAD_CONFIG_ENABLE_TX_ERROR_RATE_TRACKING` is set). + * + * OpenThread maintains the average error rate of IPv6 messages per neighbor. This parameter specifies the + * window (in terms of number of messages) over which the average error rate is maintained. Practically, the average + * value can be considered as the percentage of failed (no ack) messages over (approximately) last AVERAGING_WINDOW + * IPv6 messages sent to a specific neighbor. + * + */ +#ifndef OPENTHREAD_CONFIG_IPV6_TX_ERR_RATE_AVERAGING_WINDOW +#define OPENTHREAD_CONFIG_IPV6_TX_ERR_RATE_AVERAGING_WINDOW 128 +#endif + +#endif // CONFIG_LINK_QUALITY_H_ diff --git a/src/core/config/openthread-core-default-config.h b/src/core/config/openthread-core-default-config.h index 107a54290..611a5e5d5 100644 --- a/src/core/config/openthread-core-default-config.h +++ b/src/core/config/openthread-core-default-config.h @@ -947,62 +947,6 @@ #define OPENTHREAD_CONFIG_ENABLE_STEERING_DATA_SET_OOB 0 #endif -/** - * @def OPENTHREAD_CONFIG_CCA_FAILURE_RATE_AVERAGING_WINDOW - * - * OpenThread's MAC implementation maintains the average failure rate of CCA (Clear Channel Assessment) operation on - * frame transmissions. This value specifies the window (in terms of number of transmissions or samples) over which the - * average rate is maintained. Practically, the average value can be considered as the percentage of CCA failures in - * (approximately) last AVERAGING_WINDOW frame transmissions. - * - */ -#ifndef OPENTHREAD_CONFIG_CCA_FAILURE_RATE_AVERAGING_WINDOW -#define OPENTHREAD_CONFIG_CCA_FAILURE_RATE_AVERAGING_WINDOW 512 -#endif - -/** - * @def OPENTHREAD_CONFIG_ENABLE_TX_ERROR_RATE_TRACKING - * - * Define as 1 to enable transmission error rate tracking (for both MAC frames and IPv6 messages). - * - * When enabled, OpenThread will track average error rate of MAC frame transmissions and IPv6 message error rate for - * every neighbor. - * - */ -#ifndef OPENTHREAD_CONFIG_ENABLE_TX_ERROR_RATE_TRACKING -#define OPENTHREAD_CONFIG_ENABLE_TX_ERROR_RATE_TRACKING 1 -#endif - -/** - * @def OPENTHREAD_CONFIG_FRAME_TX_ERR_RATE_AVERAGING_WINDOW - * - * Applicable only if error rate tracking is enabled (i.e., `OPENTHREAD_CONFIG_ENABLE_TX_ERROR_RATE_TRACKING` is set). - * - * OpenThread's MAC implementation maintains the average error rate of MAC frame transmissions per neighbor. This - * parameter specifies the window (in terms of number of frames/sample) over which the average error rate is maintained. - * Practically, the average value can be considered as the percentage of failed (no ack) MAC frame transmissions over - * (approximately) last AVERAGING_WINDOW frame transmission attempts to a specific neighbor. - * - */ -#ifndef OPENTHREAD_CONFIG_FRAME_TX_ERR_RATE_AVERAGING_WINDOW -#define OPENTHREAD_CONFIG_FRAME_TX_ERR_RATE_AVERAGING_WINDOW 128 -#endif - -/** - * @def OPENTHREAD_CONFIG_IPV6_TX_ERR_RATE_AVERAGING_WINDOW - * - * Applicable only if error rate tracking is enabled (i.e., `OPENTHREAD_CONFIG_ENABLE_TX_ERROR_RATE_TRACKING` is set). - * - * OpenThread maintains the average error rate of IPv6 messages per neighbor. This parameter specifies the - * window (in terms of number of messages) over which the average error rate is maintained. Practically, the average - * value can be considered as the percentage of failed (no ack) messages over (approximately) last AVERAGING_WINDOW - * IPv6 messages sent to a specific neighbor. - * - */ -#ifndef OPENTHREAD_CONFIG_IPV6_TX_ERR_RATE_AVERAGING_WINDOW -#define OPENTHREAD_CONFIG_IPV6_TX_ERR_RATE_AVERAGING_WINDOW 128 -#endif - /** * @def OPENTHREAD_CONFIG_INFORM_PREVIOUS_PARENT_ON_REATTACH * diff --git a/src/core/openthread-core-config.h b/src/core/openthread-core-config.h index 9205312f1..2a40688a4 100644 --- a/src/core/openthread-core-config.h +++ b/src/core/openthread-core-config.h @@ -57,6 +57,7 @@ #include "config/dns_client.h" #include "config/ip6.h" #include "config/joiner.h" +#include "config/link_quality.h" #if OPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE || OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE || \ OPENTHREAD_CONFIG_COMMISSIONER_ENABLE || OPENTHREAD_CONFIG_JOINER_ENABLE