Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e7c5a2ad authored by Chiachang Wang's avatar Chiachang Wang Committed by android-build-merger
Browse files

Merge "Evaluate data stall via tcp signal" am: 94b74699 am: fe673d13

am: a74fcdd2

Change-Id: I466307db4fa385c8f77cc4026bdee9876c2e736d
parents 0e1f8a97 a74fcdd2
Loading
Loading
Loading
Loading
+48 −5
Original line number Diff line number Diff line
@@ -20,10 +20,11 @@ package android.net.util;
 * Collection of utilities for data stall.
 */
public class DataStallUtils {
    /**
     * Detect data stall via using dns timeout counts.
     */
    public static final int DATA_STALL_EVALUATION_TYPE_DNS = 1;
    /** Detect data stall using dns timeout counts. */
    public static final int DATA_STALL_EVALUATION_TYPE_DNS = 1 << 0;
    /** Detect data stall using tcp connection fail rate. */
    public static final int DATA_STALL_EVALUATION_TYPE_TCP = 1 << 1;

    // Default configuration values for data stall detection.
    public static final int DEFAULT_CONSECUTIVE_DNS_TIMEOUT_THRESHOLD = 5;
    public static final int DEFAULT_DATA_STALL_MIN_EVALUATE_TIME_MS = 60 * 1000;
@@ -60,13 +61,55 @@ public class DataStallUtils {
     * Type: int
     * Valid values:
     *   {@link #DATA_STALL_EVALUATION_TYPE_DNS} : Use dns as a signal.
     *   {@link #DATA_STALL_EVALUATION_TYPE_TCP} : Use tcp info as a signal.
     */
    public static final String CONFIG_DATA_STALL_EVALUATION_TYPE = "data_stall_evaluation_type";
    public static final int DEFAULT_DATA_STALL_EVALUATION_TYPES = DATA_STALL_EVALUATION_TYPE_DNS;
    public static final int DEFAULT_DATA_STALL_EVALUATION_TYPES =
            DATA_STALL_EVALUATION_TYPE_DNS | DATA_STALL_EVALUATION_TYPE_TCP;
    // The default number of DNS events kept of the log kept for dns signal evaluation. Each event
    // is represented by a {@link com.android.server.connectivity.NetworkMonitor#DnsResult} objects.
    // It's also the size of array of {@link com.android.server.connectivity.nano.DnsEvent} kept in
    // metrics. Note that increasing the size may cause statsd log buffer bust. Need to check the
    // design in statsd when you try to increase the size.
    public static final int DEFAULT_DNS_LOG_SIZE = 20;

    /**
     * The time interval for polling tcp info to observe the tcp health.
     */
    public static String CONFIG_DATA_STALL_TCP_POLLING_INTERVAL = "data_stall_tcp_polling_interval";

    /**
     * Default polling interval to observe the tcp health.
     */
    public static int DEFAULT_TCP_POLLING_INTERVAL_MS = 10_000;

    /**
     * Default tcp packets fail rate to suspect as a data stall.
     *
     * Calculated by ((# of packets lost)+(# of packets retrans))/(# of packets sent)*100. Ideally,
     * the percentage should be 100%. However, the ongoing packets may not be considered as neither
     * lost or retrans yet. It will cause the percentage lower.
     */
    public static final int DEFAULT_TCP_PACKETS_FAIL_PERCENTAGE = 80;

    /**
     * The percentage of tcp packets fail rate to be suspected as a data stall.
     *
     * Type: int
     * Valid values: 0 to 100.
     */
    public static final String CONFIG_TCP_PACKETS_FAIL_RATE = "tcp_packets_fail_rate";

    /** Corresponds to enum from bionic/libc/include/netinet/tcp.h. */
    public static final int TCP_ESTABLISHED = 1;
    public static final int TCP_SYN_SENT = 2;
    public static final int TCP_SYN_RECV = 3;
    public static final int TCP_MONITOR_STATE_FILTER =
            (1 << TCP_ESTABLISHED) | (1 << TCP_SYN_SENT) | (1 << TCP_SYN_RECV);

    /**
     * Threshold for the minimal tcp packets count to evaluate data stall via tcp info.
     */
    public static final int DEFAULT_DATA_STALL_MIN_PACKETS_THRESHOLD = 10;
    public static final String CONFIG_MIN_PACKETS_THRESHOLD = "tcp_min_packets_threshold";
}
+498 −0

File added.

Preview size limit exceeded, changes collapsed.

+71 −9

File changed.

Preview size limit exceeded, changes collapsed.

+303 −0

File added.

Preview size limit exceeded, changes collapsed.

+34 −0

File changed.

Preview size limit exceeded, changes collapsed.