1/* 2 * Copyright (C) 2023 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17syntax = "proto2"; 18 19package android.os.statsd.threadnetwork; 20 21import "frameworks/proto_logging/stats/atom_field_options.proto"; 22 23option java_package = "com.android.os.threadnetwork"; 24option java_multiple_files = true; 25 26// Thread Telemetry data definition. 27message ThreadnetworkTelemetryDataReported { 28 message WpanStats { 29 optional int32 phy_rx = 1; 30 optional int32 phy_tx = 2; 31 optional int32 mac_unicast_rx = 3; 32 optional int32 mac_unicast_tx = 4; 33 optional int32 mac_broadcast_rx = 5; 34 optional int32 mac_broadcast_tx = 6; 35 optional int32 mac_tx_ack_req = 7; 36 optional int32 mac_tx_no_ack_req = 8; 37 optional int32 mac_tx_acked = 9; 38 optional int32 mac_tx_data = 10; 39 optional int32 mac_tx_data_poll = 11; 40 optional int32 mac_tx_beacon = 12; 41 optional int32 mac_tx_beacon_req = 13; 42 optional int32 mac_tx_other_pkt = 14; 43 optional int32 mac_tx_retry = 15; 44 optional int32 mac_rx_data = 16; 45 optional int32 mac_rx_data_poll = 17; 46 optional int32 mac_rx_beacon = 18; 47 optional int32 mac_rx_beacon_req = 19; 48 optional int32 mac_rx_other_pkt = 20; 49 optional int32 mac_rx_filter_whitelist = 21; 50 optional int32 mac_rx_filter_dest_addr = 22; 51 optional int32 mac_tx_fail_cca = 23; 52 optional int32 mac_rx_fail_decrypt = 24; 53 optional int32 mac_rx_fail_no_frame = 25; 54 optional int32 mac_rx_fail_unknown_neighbor = 26; 55 optional int32 mac_rx_fail_invalid_src_addr = 27; 56 optional int32 mac_rx_fail_fcs = 28; 57 optional int32 mac_rx_fail_other = 29; 58 optional int32 ip_tx_success = 30; 59 optional int32 ip_rx_success = 31; 60 optional int32 ip_tx_failure = 32; 61 optional int32 ip_rx_failure = 33; 62 optional uint32 node_type = 34; 63 optional uint32 channel = 35; 64 optional int32 radio_tx_power = 36; 65 optional float mac_cca_fail_rate = 37; 66 } 67 68 message WpanTopoFull { 69 optional uint32 rloc16 = 1; 70 optional uint32 router_id = 2; 71 optional uint32 leader_router_id = 3; 72 optional uint32 leader_rloc16 = 4; // replaced optional bytes leader_address = 5; 73 optional uint32 leader_weight = 5; 74 optional uint32 leader_local_weight = 6; 75 optional uint32 preferred_router_id = 7; 76 optional uint32 partition_id = 8; 77 optional uint32 child_table_size = 9; 78 optional uint32 neighbor_table_size = 10; 79 optional int32 instant_rssi = 11; 80 optional bool has_extended_pan_id = 12; 81 optional bool is_active_br = 13; 82 optional bool is_active_srp_server = 14; 83 optional uint32 sum_on_link_prefix_changes = 15; 84 } 85 86 enum NodeType { 87 NODE_TYPE_UNSPECIFIED = 0; 88 NODE_TYPE_ROUTER = 1; 89 NODE_TYPE_END = 2; 90 NODE_TYPE_SLEEPY_END = 3; 91 NODE_TYPE_MINIMAL_END = 4; 92 93 NODE_TYPE_OFFLINE = 5; 94 NODE_TYPE_DISABLED = 6; 95 NODE_TYPE_DETACHED = 7; 96 97 NODE_TYPE_NL_LURKER = 0x10; 98 NODE_TYPE_COMMISSIONER = 0x20; 99 NODE_TYPE_LEADER = 0x40; 100 } 101 102 message PacketsAndBytes { 103 optional int64 packet_count = 1; 104 optional int64 byte_count = 2; 105 } 106 107 message Nat64TrafficCounters { 108 optional int64 ipv4_to_ipv6_packets = 1; 109 optional int64 ipv4_to_ipv6_bytes = 2; 110 optional int64 ipv6_to_ipv4_packets = 3; 111 optional int64 ipv6_to_ipv4_bytes = 4; 112 } 113 114 message Nat64ProtocolCounters { 115 optional Nat64TrafficCounters tcp = 1; 116 optional Nat64TrafficCounters udp = 2; 117 optional Nat64TrafficCounters icmp = 3; 118 } 119 120 message Nat64PacketCounters { 121 optional int64 ipv4_to_ipv6_packets = 1; 122 optional int64 ipv6_to_ipv4_packets = 2; 123 } 124 125 message Nat64ErrorCounters { 126 optional Nat64PacketCounters unknown = 1; 127 optional Nat64PacketCounters illegal_packet = 2; 128 optional Nat64PacketCounters unsupported_protocol = 3; 129 optional Nat64PacketCounters no_mapping = 4; 130 } 131 132 message BorderRoutingCounters { 133 // The number of Router Advertisement packets received by otbr-agent on the 134 // infra link 135 optional int64 ra_rx = 1; 136 137 // The number of Router Advertisement packets successfully transmitted by 138 // otbr-agent on the infra link. 139 optional int64 ra_tx_success = 2; 140 141 // The number of Router Advertisement packets failed to transmit by 142 // otbr-agent on the infra link. 143 optional int64 ra_tx_failure = 3; 144 145 // The number of Router Solicitation packets received by otbr-agent on the 146 // infra link 147 optional int64 rs_rx = 4; 148 149 // The number of Router Solicitation packets successfully transmitted by 150 // otbr-agent on the infra link. 151 optional int64 rs_tx_success = 5; 152 153 // The number of Router Solicitation packets failed to transmit by 154 // otbr-agent on the infra link. 155 optional int64 rs_tx_failure = 6; 156 157 // The counters for inbound unicast packets 158 optional PacketsAndBytes inbound_unicast = 7; 159 160 // The counters for inbound multicast packets 161 optional PacketsAndBytes inbound_multicast = 8; 162 163 // The counters for outbound unicast packets 164 optional PacketsAndBytes outbound_unicast = 9; 165 166 // The counters for outbound multicast packets 167 optional PacketsAndBytes outbound_multicast = 10; 168 169 // The inbound and outbound NAT64 traffic through the border router 170 optional Nat64ProtocolCounters nat64_protocol_counters = 11; 171 172 // Error counters for NAT64 translator on the border router 173 optional Nat64ErrorCounters nat64_error_counters = 12; 174 } 175 176 message SrpServerRegistrationInfo { 177 // The number of active hosts/services registered on the SRP server. 178 optional uint32 fresh_count = 1; 179 180 // The number of hosts/services in 'Deleted' state on the SRP server. 181 optional uint32 deleted_count = 2; 182 183 // The sum of lease time in milliseconds of all active hosts/services on the 184 // SRP server. 185 optional uint64 lease_time_total_ms = 3; 186 187 // The sum of key lease time in milliseconds of all active hosts/services on 188 // the SRP server. 189 optional uint64 key_lease_time_total_ms = 4; 190 191 // The sum of remaining lease time in milliseconds of all active 192 // hosts/services on the SRP server. 193 optional uint64 remaining_lease_time_total_ms = 5; 194 195 // The sum of remaining key lease time in milliseconds of all active 196 // hosts/services on the SRP server. 197 optional uint64 remaining_key_lease_time_total_ms = 6; 198 } 199 200 message SrpServerResponseCounters { 201 // The number of successful responses 202 optional uint32 success_count = 1; 203 204 // The number of server failure responses 205 optional uint32 server_failure_count = 2; 206 207 // The number of format error responses 208 optional uint32 format_error_count = 3; 209 210 // The number of 'name exists' responses 211 optional uint32 name_exists_count = 4; 212 213 // The number of refused responses 214 optional uint32 refused_count = 5; 215 216 // The number of other responses 217 optional uint32 other_count = 6; 218 } 219 220 enum SrpServerState { 221 SRP_SERVER_STATE_UNSPECIFIED = 0; 222 SRP_SERVER_STATE_DISABLED = 1; 223 SRP_SERVER_STATE_RUNNING = 2; 224 SRP_SERVER_STATE_STOPPED = 3; 225 } 226 227 // The address mode used by the SRP server 228 enum SrpServerAddressMode { 229 SRP_SERVER_ADDRESS_MODE_UNSPECIFIED = 0; 230 SRP_SERVER_ADDRESS_MODE_UNICAST = 1; 231 SRP_SERVER_ADDRESS_MODE_STATE_ANYCAST = 2; 232 } 233 234 enum UpstreamDnsQueryState { 235 UPSTREAMDNS_QUERY_STATE_UNSPECIFIED = 0; 236 UPSTREAMDNS_QUERY_STATE_ENABLED = 1; 237 UPSTREAMDNS_QUERY_STATE_DISABLED = 2; 238 } 239 240 message SrpServerInfo { 241 // The state of the SRP server 242 optional SrpServerState state = 1; 243 244 // Listening port number 245 optional uint32 port = 2; 246 // The address mode {unicast, anycast} of the SRP server 247 optional SrpServerAddressMode address_mode = 3; 248 249 // The registration information of hosts on the SRP server 250 optional SrpServerRegistrationInfo hosts = 4; 251 252 // The registration information of services on the SRP server 253 optional SrpServerRegistrationInfo services = 5; 254 255 // The counters of response codes sent by the SRP server 256 optional SrpServerResponseCounters response_counters = 6; 257 } 258 259 message DnsServerResponseCounters { 260 // The number of successful responses 261 optional uint32 success_count = 1; 262 263 // The number of server failure responses 264 optional uint32 server_failure_count = 2; 265 266 // The number of format error responses 267 optional uint32 format_error_count = 3; 268 269 // The number of name error responses 270 optional uint32 name_error_count = 4; 271 272 // The number of 'not implemented' responses 273 optional uint32 not_implemented_count = 5; 274 275 // The number of other responses 276 optional uint32 other_count = 6; 277 278 // The number of queries handled by Upstream DNS server. 279 optional uint32 upstream_dns_queries = 7; 280 281 // The number of responses handled by Upstream DNS server. 282 optional uint32 upstream_dns_responses = 8; 283 284 // The number of upstream DNS failures. 285 optional uint32 upstream_dns_failures = 9; 286 } 287 288 message DnsServerInfo { 289 // The counters of response codes sent by the DNS server 290 optional DnsServerResponseCounters response_counters = 1; 291 292 // The number of DNS queries resolved at the local SRP server 293 optional uint32 resolved_by_local_srp_count = 2; 294 295 // The state of upstream DNS query 296 optional UpstreamDnsQueryState upstream_dns_query_state = 3; 297 } 298 299 message MdnsResponseCounters { 300 // The number of successful responses 301 optional uint32 success_count = 1; 302 303 // The number of 'not found' responses 304 optional uint32 not_found_count = 2; 305 306 // The number of 'invalid arg' responses 307 optional uint32 invalid_args_count = 3; 308 309 // The number of 'duplicated' responses 310 optional uint32 duplicated_count = 4; 311 312 // The number of 'not implemented' responses 313 optional uint32 not_implemented_count = 5; 314 315 // The number of unknown error responses 316 optional uint32 unknown_error_count = 6; 317 318 // The number of aborted responses 319 optional uint32 aborted_count = 7; 320 321 // The number of invalid state responses 322 optional uint32 invalid_state_count = 8; 323 } 324 325 message MdnsInfo { 326 // The response counters of host registrations 327 optional MdnsResponseCounters host_registration_responses = 1; 328 329 // The response counters of service registrations 330 optional MdnsResponseCounters service_registration_responses = 2; 331 332 // The response counters of host resolutions 333 optional MdnsResponseCounters host_resolution_responses = 3; 334 335 // The response counters of service resolutions 336 optional MdnsResponseCounters service_resolution_responses = 4; 337 338 // The EMA (Exponential Moving Average) latencies of mDNS operations 339 340 // The EMA latency of host registrations in milliseconds 341 optional uint32 host_registration_ema_latency_ms = 5; 342 343 // The EMA latency of service registrations in milliseconds 344 optional uint32 service_registration_ema_latency_ms = 6; 345 346 // The EMA latency of host resolutions in milliseconds 347 optional uint32 host_resolution_ema_latency_ms = 7; 348 349 // The EMA latency of service resolutions in milliseconds 350 optional uint32 service_resolution_ema_latency_ms = 8; 351 } 352 353 enum Nat64State { 354 NAT64_STATE_UNSPECIFIED = 0; 355 NAT64_STATE_DISABLED = 1; 356 NAT64_STATE_NOT_RUNNING = 2; 357 NAT64_STATE_IDLE = 3; 358 NAT64_STATE_ACTIVE = 4; 359 } 360 361 message BorderRoutingNat64State { 362 optional Nat64State prefix_manager_state = 1; 363 optional Nat64State translator_state = 2; 364 } 365 366 message TrelPacketCounters { 367 // The number of packets successfully transmitted through TREL 368 optional uint64 trel_tx_packets = 1; 369 370 // The number of bytes successfully transmitted through TREL 371 optional uint64 trel_tx_bytes = 2; 372 373 // The number of packet transmission failures through TREL 374 optional uint64 trel_tx_packets_failed = 3; 375 376 // The number of packets successfully received through TREL 377 optional uint64 trel_rx_packets = 4; 378 379 // The number of bytes successfully received through TREL 380 optional uint64 trel_rx_bytes = 5; 381 } 382 383 message TrelInfo { 384 // Whether TREL is enabled. 385 optional bool is_trel_enabled = 1; 386 387 // The number of TREL peers. 388 optional uint32 num_trel_peers = 2; 389 390 // TREL packet counters 391 optional TrelPacketCounters counters = 3; 392 } 393 394 message BorderAgentCounters { 395 // The number of ePSKc activations 396 optional uint32 epskc_activations = 1; 397 398 // The number of ePSKc deactivations due to cleared via API 399 optional uint32 epskc_deactivation_clears = 2; 400 401 // The number of ePSKc deactivations due to timeout 402 optional uint32 epskc_deactivation_timeouts = 3; 403 404 // The number of ePSKc deactivations due to max connection attempts reached 405 optional uint32 epskc_deactivation_max_attempts = 4; 406 407 // The number of ePSKc deactivations due to commissioner disconnected 408 optional uint32 epskc_deactivation_disconnects = 5; 409 410 // The number of ePSKc activation failures caused by invalid border agent 411 // state 412 optional uint32 epskc_invalid_ba_state_errors = 6; 413 414 // The number of ePSKc activation failures caused by invalid argument 415 optional uint32 epskc_invalid_args_errors = 7; 416 417 // The number of ePSKc activation failures caused by failed to start secure 418 // session 419 optional uint32 epskc_start_secure_session_errors = 8; 420 421 // The number of successful secure session establishment with ePSKc 422 optional uint32 epskc_secure_session_successes = 9; 423 424 // The number of failed secure session establishement with ePSKc 425 optional uint32 epskc_secure_session_failures = 10; 426 427 // The number of active commissioner petitioned over secure session 428 // establishment with ePSKc 429 optional uint32 epskc_commissioner_petitions = 11; 430 431 // The number of successful secure session establishment with PSKc 432 optional uint32 pskc_secure_session_successes = 12; 433 434 // The number of failed secure session establishement with PSKc 435 optional uint32 pskc_secure_session_failures = 13; 436 437 // The number of active commissioner petitioned over secure session 438 // establishment with PSKc 439 optional uint32 pskc_commissioner_petitions = 14; 440 441 // The number of MGMT_ACTIVE_GET.req received 442 optional uint32 mgmt_active_get_reqs = 15; 443 444 // The number of MGMT_PENDING_GET.req received 445 optional uint32 mgmt_pending_get_reqs = 16; 446 } 447 448 message BorderAgentInfo { 449 // The border agent counters 450 optional BorderAgentCounters border_agent_counters = 1; 451 } 452 453 message WpanBorderRouter { 454 // Border routing counters 455 optional BorderRoutingCounters border_routing_counters = 1; 456 457 // Information about the SRP server 458 optional SrpServerInfo srp_server = 2; 459 460 // Information about the DNS server 461 optional DnsServerInfo dns_server = 3; 462 463 // Information about the mDNS publisher 464 optional MdnsInfo mdns = 4; 465 466 // Information about the state of components of NAT64 467 optional BorderRoutingNat64State nat64_state = 5; 468 469 // Information about TREL. 470 optional TrelInfo trel_info = 6; 471 472 // Information about the Border Agent 473 optional BorderAgentInfo border_agent_info = 7; 474 } 475 476 message RcpStabilityStatistics { 477 optional uint32 rcp_timeout_count = 1; 478 optional uint32 rcp_reset_count = 2; 479 optional uint32 rcp_restoration_count = 3; 480 optional uint32 spinel_parse_error_count = 4; 481 optional int32 rcp_firmware_update_count = 5; 482 optional uint32 thread_stack_uptime = 6; 483 } 484 485 message RcpInterfaceStatistics { 486 optional uint32 rcp_interface_type = 1; 487 optional uint64 transferred_frames_count = 2; 488 optional uint64 transferred_valid_frames_count = 3; 489 optional uint64 transferred_garbage_frames_count = 4; 490 optional uint64 rx_frames_count = 5; 491 optional uint64 rx_bytes_count = 6; 492 optional uint64 tx_frames_count = 7; 493 optional uint64 tx_bytes_count = 8; 494 } 495 496 message WpanRcp { 497 optional RcpStabilityStatistics rcp_stability_statistics = 1; 498 optional RcpInterfaceStatistics rcp_interface_statistics = 2; 499 } 500 501 message CoexMetrics { 502 optional uint32 count_tx_request = 1; 503 optional uint32 count_tx_grant_immediate = 2; 504 optional uint32 count_tx_grant_wait = 3; 505 optional uint32 count_tx_grant_wait_activated = 4; 506 optional uint32 count_tx_grant_wait_timeout = 5; 507 optional uint32 count_tx_grant_deactivated_during_request = 6; 508 optional uint32 tx_average_request_to_grant_time_us = 7; 509 optional uint32 count_rx_request = 8; 510 optional uint32 count_rx_grant_immediate = 9; 511 optional uint32 count_rx_grant_wait = 10; 512 optional uint32 count_rx_grant_wait_activated = 11; 513 optional uint32 count_rx_grant_wait_timeout = 12; 514 optional uint32 count_rx_grant_deactivated_during_request = 13; 515 optional uint32 count_rx_grant_none = 14; 516 optional uint32 rx_average_request_to_grant_time_us = 15; 517 } 518 519 optional WpanStats wpan_stats = 1 [(log_mode) = MODE_BYTES]; 520 optional WpanTopoFull wpan_topo_full = 2 [(log_mode) = MODE_BYTES]; 521 optional WpanBorderRouter wpan_border_router = 3 [(log_mode) = MODE_BYTES]; 522 optional WpanRcp wpan_rcp = 4 [(log_mode) = MODE_BYTES]; 523 optional CoexMetrics coex_metrics = 5 [(log_mode) = MODE_BYTES]; 524} 525 526message ThreadnetworkTopoEntryRepeated { 527 message TopoEntry { 528 // 0~15: uint16_t rloc_16 529 // 16~31: uint16_t version Thread version of the neighbor 530 optional uint32 combo_telemetry1 = 1; 531 // 0~7: uint8_t link_quality_in 532 // 8~15: int8_t average_rssi 533 // 16~23: int8_t last_rssi 534 // 24~31: uint8_t network_data_version 535 optional uint32 combo_telemetry2 = 2; 536 optional uint32 age_sec = 3; 537 // Each bit on the flag represents a bool flag 538 // 0: rx_on_when_idle 539 // 1: full_function 540 // 2: secure_data_request 541 // 3: full_network_data 542 // 4: is_child 543 optional uint32 topo_entry_flags = 4; 544 optional uint32 link_frame_counter = 5; 545 optional uint32 mle_frame_counter = 6; 546 optional uint32 timeout_sec = 7; 547 // 0~15: uint16_t frame_error_rate. Frame error rate (0xffff->100%). Requires error tracking feature. 548 // 16~31: uint16_t message_error_rate. (IPv6) msg error rate (0xffff->100%). Requires error tracking feature. 549 optional uint32 combo_telemetry3 = 8; 550 } 551 552 message TopoEntryRepeated { 553 repeated TopoEntry topo_entries = 1; 554 } 555 556 optional TopoEntryRepeated topo_entry_repeated = 1 [(log_mode) = MODE_BYTES]; 557} 558 559message ThreadnetworkDeviceInfoReported { 560 // OpenThread host build version. 561 optional string ot_host_version = 1; 562 563 // OpenThread RCP build version. 564 optional string ot_rcp_version = 2; 565 566 // Thread protocol version. 567 optional int32 thread_version = 3; 568 569 // Thread Daemon version. 570 optional string thread_daemon_version = 4; 571} 572