1 /* 2 * Copyright (c) 2000-2021 Apple Inc. All rights reserved. 3 * 4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ 5 * 6 * This file contains Original Code and/or Modifications of Original Code 7 * as defined in and that are subject to the Apple Public Source License 8 * Version 2.0 (the 'License'). You may not use this file except in 9 * compliance with the License. The rights granted to you under the License 10 * may not be used to create, or enable the creation or redistribution of, 11 * unlawful or unlicensed copies of an Apple operating system, or to 12 * circumvent, violate, or enable the circumvention or violation of, any 13 * terms of an Apple operating system software license agreement. 14 * 15 * Please obtain a copy of the License at 16 * http://www.opensource.apple.com/apsl/ and read it before using this file. 17 * 18 * The Original Code and all software distributed under the License are 19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23 * Please see the License for the specific language governing rights and 24 * limitations under the License. 25 * 26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27 */ 28 /* 29 * Copyright (c) 1982, 1986, 1989, 1993 30 * The Regents of the University of California. All rights reserved. 31 * 32 * Redistribution and use in source and binary forms, with or without 33 * modification, are permitted provided that the following conditions 34 * are met: 35 * 1. Redistributions of source code must retain the above copyright 36 * notice, this list of conditions and the following disclaimer. 37 * 2. Redistributions in binary form must reproduce the above copyright 38 * notice, this list of conditions and the following disclaimer in the 39 * documentation and/or other materials provided with the distribution. 40 * 3. All advertising materials mentioning features or use of this software 41 * must display the following acknowledgement: 42 * This product includes software developed by the University of 43 * California, Berkeley and its contributors. 44 * 4. Neither the name of the University nor the names of its contributors 45 * may be used to endorse or promote products derived from this software 46 * without specific prior written permission. 47 * 48 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 49 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 50 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 51 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 52 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 53 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 54 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 55 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 56 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 57 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 58 * SUCH DAMAGE. 59 * 60 * From: @(#)if.h 8.1 (Berkeley) 6/10/93 61 * $FreeBSD: src/sys/net/if_var.h,v 1.18.2.7 2001/07/24 19:10:18 brooks Exp $ 62 */ 63 64 #ifndef _NET_IF_VAR_STATUS_H_ 65 #define _NET_IF_VAR_STATUS_H_ 66 67 #include <machine/types.h> 68 #include <stdint.h> 69 70 #pragma pack(4) 71 72 /* 73 * Interface link status report -- includes statistics related to 74 * the link layer technology sent by the driver. The driver will monitor 75 * these statistics over an interval (3-4 secs) and will generate a report 76 * to the network stack. This will give first-hand information about the 77 * status of the first hop of the network path. The version and 78 * length values should be correct for the data to be processed correctly. 79 * The definitions are different for different kind of interfaces like 80 * Wifi, Cellular etc,. 81 */ 82 #define IF_CELLULAR_STATUS_REPORT_VERSION_1 1 83 #define IF_WIFI_STATUS_REPORT_VERSION_1 1 84 #define IF_CELLULAR_STATUS_REPORT_CURRENT_VERSION \ 85 IF_CELLULAR_STATUS_REPORT_VERSION_1 86 #define IF_WIFI_STATUS_REPORT_CURRENT_VERSION IF_WIFI_STATUS_REPORT_VERSION_1 87 /* 88 * For cellular interface -- 89 * There is no way to share common headers between the Baseband and 90 * the kernel. Any changes to this structure will need to be communicated 91 * to the Baseband team. It is better to use reserved space instead of 92 * changing the size or existing fields in the structure. 93 */ 94 struct if_cellular_status_v1 { 95 u_int32_t valid_bitmask; /* indicates which fields are valid */ 96 #define IF_CELL_LINK_QUALITY_METRIC_VALID 0x1 97 #define IF_CELL_UL_EFFECTIVE_BANDWIDTH_VALID 0x2 98 #define IF_CELL_UL_MAX_BANDWIDTH_VALID 0x4 99 #define IF_CELL_UL_MIN_LATENCY_VALID 0x8 100 #define IF_CELL_UL_EFFECTIVE_LATENCY_VALID 0x10 101 #define IF_CELL_UL_MAX_LATENCY_VALID 0x20 102 #define IF_CELL_UL_RETXT_LEVEL_VALID 0x40 103 #define IF_CELL_UL_BYTES_LOST_VALID 0x80 104 #define IF_CELL_UL_MIN_QUEUE_SIZE_VALID 0x100 105 #define IF_CELL_UL_AVG_QUEUE_SIZE_VALID 0x200 106 #define IF_CELL_UL_MAX_QUEUE_SIZE_VALID 0x400 107 #define IF_CELL_DL_EFFECTIVE_BANDWIDTH_VALID 0x800 108 #define IF_CELL_DL_MAX_BANDWIDTH_VALID 0x1000 109 #define IF_CELL_CONFIG_INACTIVITY_TIME_VALID 0x2000 110 #define IF_CELL_CONFIG_BACKOFF_TIME_VALID 0x4000 111 #define IF_CELL_UL_MSS_RECOMMENDED_VALID 0x8000 112 113 u_int32_t link_quality_metric; 114 u_int32_t ul_effective_bandwidth; /* Measured uplink bandwidth based on current activity (bps) */ 115 u_int32_t ul_max_bandwidth; /* Maximum supported uplink bandwidth (bps) */ 116 u_int32_t ul_min_latency; /* min expected uplink latency for first hop (ms) */ 117 u_int32_t ul_effective_latency; /* current expected uplink latency for first hop (ms) */ 118 u_int32_t ul_max_latency; /* max expected uplink latency first hop (ms) */ 119 u_int32_t ul_retxt_level; /* Retransmission metric */ 120 #define IF_CELL_UL_RETXT_LEVEL_NONE 1 121 #define IF_CELL_UL_RETXT_LEVEL_LOW 2 122 #define IF_CELL_UL_RETXT_LEVEL_MEDIUM 3 123 #define IF_CELL_UL_RETXT_LEVEL_HIGH 4 124 u_int32_t ul_bytes_lost; /* % of total bytes lost on uplink in Q10 format */ 125 u_int32_t ul_min_queue_size; /* minimum bytes in queue */ 126 u_int32_t ul_avg_queue_size; /* average bytes in queue */ 127 u_int32_t ul_max_queue_size; /* maximum bytes in queue */ 128 u_int32_t dl_effective_bandwidth; /* Measured downlink bandwidth based on current activity (bps) */ 129 u_int32_t dl_max_bandwidth; /* Maximum supported downlink bandwidth (bps) */ 130 u_int32_t config_inactivity_time; /* ms */ 131 u_int32_t config_backoff_time; /* new connections backoff time in ms */ 132 #define IF_CELL_UL_MSS_RECOMMENDED_NONE 0x0 /* Use default */ 133 #define IF_CELL_UL_MSS_RECOMMENDED_MEDIUM 0x1 /* 1200 byte MSS */ 134 #define IF_CELL_UL_MSS_RECOMMENDED_LOW 0x2 /* 512 byte MSS */ 135 u_int16_t mss_recommended; 136 u_int16_t reserved_1; 137 u_int32_t reserved_2; 138 u_int64_t reserved_3; 139 u_int64_t reserved_4; 140 u_int64_t reserved_5; 141 u_int64_t reserved_6; 142 } __attribute__((packed)); 143 144 struct if_cellular_status { 145 union { 146 struct if_cellular_status_v1 if_status_v1; 147 } if_cell_u; 148 }; 149 150 /* 151 * These statistics will be provided by the Wifi driver periodically. 152 * After sending each report, the driver should start computing again 153 * for the next report duration so that the values represent the link 154 * status for one report duration. 155 */ 156 157 struct if_wifi_status_v1 { 158 u_int32_t valid_bitmask; 159 #define IF_WIFI_LINK_QUALITY_METRIC_VALID 0x1 160 #define IF_WIFI_UL_EFFECTIVE_BANDWIDTH_VALID 0x2 161 #define IF_WIFI_UL_MAX_BANDWIDTH_VALID 0x4 162 #define IF_WIFI_UL_MIN_LATENCY_VALID 0x8 163 #define IF_WIFI_UL_EFFECTIVE_LATENCY_VALID 0x10 164 #define IF_WIFI_UL_MAX_LATENCY_VALID 0x20 165 #define IF_WIFI_UL_RETXT_LEVEL_VALID 0x40 166 #define IF_WIFI_UL_ERROR_RATE_VALID 0x80 167 #define IF_WIFI_UL_BYTES_LOST_VALID 0x100 168 #define IF_WIFI_DL_EFFECTIVE_BANDWIDTH_VALID 0x200 169 #define IF_WIFI_DL_MAX_BANDWIDTH_VALID 0x400 170 #define IF_WIFI_DL_MIN_LATENCY_VALID 0x800 171 #define IF_WIFI_DL_EFFECTIVE_LATENCY_VALID 0x1000 172 #define IF_WIFI_DL_MAX_LATENCY_VALID 0x2000 173 #define IF_WIFI_DL_ERROR_RATE_VALID 0x4000 174 #define IF_WIFI_CONFIG_FREQUENCY_VALID 0x8000 175 #define IF_WIFI_CONFIG_MULTICAST_RATE_VALID 0x10000 176 #define IF_WIFI_CONFIG_SCAN_COUNT_VALID 0x20000 177 #define IF_WIFI_CONFIG_SCAN_DURATION_VALID 0x40000 178 u_int32_t link_quality_metric; /* link quality metric */ 179 u_int32_t ul_effective_bandwidth; /* Measured uplink bandwidth based on current activity (bps) */ 180 u_int32_t ul_max_bandwidth; /* Maximum supported uplink bandwidth (bps) */ 181 u_int32_t ul_min_latency; /* min expected uplink latency for first hop (ms) */ 182 u_int32_t ul_effective_latency; /* current expected uplink latency for first hop (ms) */ 183 u_int32_t ul_max_latency; /* max expected uplink latency for first hop (ms) */ 184 u_int32_t ul_retxt_level; /* Retransmission metric */ 185 #define IF_WIFI_UL_RETXT_LEVEL_NONE 1 186 #define IF_WIFI_UL_RETXT_LEVEL_LOW 2 187 #define IF_WIFI_UL_RETXT_LEVEL_MEDIUM 3 188 #define IF_WIFI_UL_RETXT_LEVEL_HIGH 4 189 u_int32_t ul_bytes_lost; /* % of total bytes lost on uplink in Q10 format */ 190 u_int32_t ul_error_rate; /* % of bytes dropped on uplink after many retransmissions in Q10 format */ 191 u_int32_t dl_effective_bandwidth; /* Measured downlink bandwidth based on current activity (bps) */ 192 u_int32_t dl_max_bandwidth; /* Maximum supported downlink bandwidth (bps) */ 193 /* 194 * The download latency values indicate the time AP may have to wait for the 195 * driver to receive the packet. These values give the range of expected latency 196 * mainly due to co-existence events and channel hopping where the interface 197 * becomes unavailable. 198 */ 199 u_int32_t dl_min_latency; /* min expected latency for first hop in ms */ 200 u_int32_t dl_effective_latency; /* current expected latency for first hop in ms */ 201 u_int32_t dl_max_latency; /* max expected latency for first hop in ms */ 202 u_int32_t dl_error_rate; /* % of CRC or other errors in Q10 format */ 203 u_int32_t config_frequency; /* 2.4 or 5 GHz */ 204 #define IF_WIFI_CONFIG_FREQUENCY_2_4_GHZ 1 205 #define IF_WIFI_CONFIG_FREQUENCY_5_0_GHZ 2 206 u_int32_t config_multicast_rate; /* bps */ 207 u_int32_t scan_count; /* scan count during the previous period */ 208 u_int32_t scan_duration; /* scan duration in ms */ 209 u_int64_t reserved_1; 210 u_int64_t reserved_2; 211 u_int64_t reserved_3; 212 u_int64_t reserved_4; 213 } __attribute__((packed)); 214 215 struct if_wifi_status { 216 union { 217 struct if_wifi_status_v1 if_status_v1; 218 } if_wifi_u; 219 }; 220 221 struct if_link_status { 222 u_int32_t ifsr_version; /* version of this report */ 223 u_int32_t ifsr_len; /* length of the following struct */ 224 union { 225 struct if_cellular_status ifsr_cell; 226 struct if_wifi_status ifsr_wifi; 227 } ifsr_u; 228 }; 229 230 /* 231 * This structure is used to define the parameters for advisory notifications 232 * on an interface. 233 */ 234 #pragma pack(push, 1) 235 enum ifnet_interface_advisory_version : uint8_t { 236 /* 237 * Initial version with interface advisory report for WiFi interface. 238 */ 239 IF_INTERFACE_ADVISORY_VERSION_1 = 1, 240 #if XNU_KERNEL_PRIVATE 241 IF_INTERFACE_ADVISORY_VERSION_MIN = IF_INTERFACE_ADVISORY_VERSION_1, 242 #endif /* XNU_KERNEL_PRIVATE */ 243 /* 244 * Reorganized the interface advisory structure to separate out 245 * WiFi and Cellular interface specific reports. 246 */ 247 IF_INTERFACE_ADVISORY_VERSION_2 = 2, 248 IF_INTERFACE_ADVISORY_VERSION_CURRENT = IF_INTERFACE_ADVISORY_VERSION_2, 249 #if XNU_KERNEL_PRIVATE 250 IF_INTERFACE_ADVISORY_VERSION_MAX = IF_INTERFACE_ADVISORY_VERSION_2, 251 #endif /* XNU_KERNEL_PRIVATE */ 252 }; 253 254 enum ifnet_interface_advisory_direction : uint8_t { 255 IF_INTERFACE_ADVISORY_DIRECTION_TX = 1, 256 IF_INTERFACE_ADVISORY_DIRECTION_RX = 2, 257 }; 258 259 enum ifnet_interface_advisory_interface_type : uint8_t { 260 IF_INTERFACE_ADVISORY_INTERFACE_TYPE_WIFI = 1, 261 #if XNU_KERNEL_PRIVATE 262 IF_INTERFACE_ADVISORY_INTERFACE_TYPE_MIN = 263 IF_INTERFACE_ADVISORY_INTERFACE_TYPE_WIFI, 264 #endif /* XNU_KERNEL_PRIVATE */ 265 IF_INTERFACE_ADVISORY_INTERFACE_TYPE_CELL = 2, 266 #if XNU_KERNEL_PRIVATE 267 IF_INTERFACE_ADVISORY_INTERFACE_TYPE_MAX = 268 IF_INTERFACE_ADVISORY_INTERFACE_TYPE_CELL, 269 #endif /* XNU_KERNEL_PRIVATE */ 270 }; 271 272 enum ifnet_interface_advisory_notification_type_cell : uint8_t { 273 /* Reserved for MAV platform */ 274 IF_INTERFACE_ADVISORY_NOTIFICATION_TYPE_CELLULAR_DEFAULT= 0, 275 /* Used when sending Codec Rate Adaptation related notifications */ 276 IF_INTERFACE_ADVISORY_NOTIFICATION_TYPE_CELLULAR_UPLINK_CRA, 277 /* 278 * Used when sending periodic measurement of parameters (RSRP,RSSI etc.) 279 * during VoLTE/VoNR calls 280 */ 281 IF_INTERFACE_ADVISORY_NOTIFICATION_TYPE_CELLULAR_MEASUREMENT_UPDATE, 282 /* Used when a TTI bundle enable/disable occurs during VoLTE/VoNR calls */ 283 IF_INTERFACE_ADVISORY_NOTIFICATION_TYPE_CELLULAR_BANDWIDTH_LIMITATION_EVENT, 284 /* Used when a configuration change occurs in CDRx during VoLTE/VoNR calls */ 285 IF_INTERFACE_ADVISORY_NOTIFICATION_TYPE_CELLULAR_DISCONTINUOUS_RECEPTION_EVENT, 286 /* Used when a handover start/end occurs during VoLTE/VoNR calls */ 287 IF_INTERFACE_ADVISORY_NOTIFICATION_TYPE_CELLULAR_OUTAGE_EVENT, 288 /* Used for Thermal Codec Rate Adaptation Events */ 289 IF_INTERFACE_ADVISORY_NOTIFICATION_TYPE_CELLULAR_THERMAL_CRA_EVENT, 290 }; 291 292 enum ifnet_interface_advisory_notification_type_wifi : uint8_t { 293 /* Unused for now */ 294 IF_INTERFACE_ADVISORY_NOTIFICATION_TYPE_WIFI_UNDEFINED = 0, 295 }; 296 297 typedef union { 298 enum ifnet_interface_advisory_notification_type_cell cell; 299 enum ifnet_interface_advisory_notification_type_wifi wifi; 300 } ifnet_interface_advisory_notification_type_t; 301 302 struct ifnet_interface_advisory_header { 303 /* The current structure version */ 304 enum ifnet_interface_advisory_version version; 305 /* Specifies if the advisory is for transmit or receive path */ 306 enum ifnet_interface_advisory_direction direction; 307 /* Interface type */ 308 enum ifnet_interface_advisory_interface_type interface_type; 309 /* Notification type */ 310 ifnet_interface_advisory_notification_type_t notification_type; 311 }; 312 313 enum ifnet_interface_advisory_rate_trend : int32_t { 314 IF_INTERFACE_ADVISORY_RATE_SUGGESTION_RAMP_UP = INT32_MAX, 315 IF_INTERFACE_ADVISORY_RATE_SUGGESTION_RAMP_DOWN = INT32_MIN, 316 IF_INTERFACE_ADVISORY_RATE_SUGGESTION_RAMP_NEUTRAL = 0, 317 }; 318 319 struct ifnet_interface_advisory_capacity { 320 /* 321 * suggestion for data rate change to keep the latency low. 322 * unit: bits per second (bps) 323 * NOTE: if the interface cannot provide suggestions in 324 * terms of bps, it should use the following values: 325 * INT32_MAX : ramp up 326 * INT32_MIN : ramp down 327 * 0 : neutral 328 */ 329 enum ifnet_interface_advisory_rate_trend rate_trend_suggestion; 330 /* 331 * Time of the issue of advisory. 332 * Timestamp should be in the host domain. 333 * unit: mach absolute time 334 */ 335 uint64_t timestamp; 336 /* 337 * Maximum theoretical bandwidth of the interface. 338 * unit: bits per second (bps) 339 */ 340 uint64_t max_bandwidth; 341 /* 342 * Total bytes sent or received on the interface. 343 * wrap around possible and the application should account for that. 344 * unit: byte 345 */ 346 uint64_t total_byte_count; 347 /* 348 * average throughput observed at the driver stack. 349 * unit: bits per second (bps) 350 */ 351 uint64_t average_throughput; 352 /* 353 * flushable queue size at the driver. 354 * should be set to UINT32_MAX if not available. 355 * unit: byte 356 */ 357 uint32_t flushable_queue_size; 358 /* 359 * non flushable queue size at the driver. 360 * should be set to UINT32_MAX if not available. 361 * unit: byte 362 */ 363 uint32_t non_flushable_queue_size; 364 /* 365 * average delay observed at the interface. 366 * unit: milliseconds (ms) 367 */ 368 uint32_t average_delay; 369 }; 370 371 enum ifnet_interface_advisory_wifi_freq_band : uint8_t { 372 IF_INTERFACE_ADVISORY_FREQ_BAND_NOT_AVAIL = 0, 373 IF_INTERFACE_ADVISORY_FREQ_BAND_WIFI_24GHZ = 1, 374 IF_INTERFACE_ADVISORY_FREQ_BAND_WIFI_5GHZ = 2, 375 IF_INTERFACE_ADVISORY_FREQ_BAND_WIFI_6GHZ = 3, 376 }; 377 378 /* 379 * This structure is used to define the parameters for advisory notifications 380 * that are specific for WiFi interface. 381 */ 382 struct ifnet_interface_advisory_wifi_context { 383 /* 384 * Current frequency band (enumeration). 385 */ 386 enum ifnet_interface_advisory_wifi_freq_band frequency_band; 387 /* 388 * Intermittent WiFi state [true(1)/false(0)] 389 */ 390 uint8_t intermittent_state; 391 /* 392 * Estimated period for which intermittent state is expected to last. 393 * 1 tick -> 1 ms UNDEF => UINT16_MAX 394 */ 395 uint16_t estimated_intermittent_period; 396 /* 397 * Expected wifi outage period during intermittent state 398 * 1 tick -> 1 ms UNDEF => UINT16_MAX 399 */ 400 uint16_t single_outage_period; 401 /* 402 * WiFi-BT coexistence, 1-ON, 0-OFF 403 */ 404 uint8_t bt_coex; 405 /* 406 * on scale of 1 to 5 407 */ 408 uint8_t quality_score_delay; 409 /* 410 * on scale of 1 to 5 411 */ 412 uint8_t quality_score_loss; 413 /* 414 * on scale of 1 to 5 415 */ 416 uint8_t quality_score_channel; 417 /* 418 * bitmap of all radio contenders. 419 */ 420 #define IF_INTERFACE_ADVISORY_WIFI_RADIO_COEX_BT 0x01 421 #define IF_INTERFACE_ADVISORY_WIFI_RADIO_COEX_AWDL 0x02 422 uint8_t radio_coex; 423 /* 424 * time available to WiFi since last notification (in ms). 425 */ 426 uint16_t wlan_duty_cycle; 427 /* 428 * bitrate information for each queue (in Kbps). 429 */ 430 #define IF_INTERFACE_ADVISORY_WIFI_TX_QUEUE_COUNT 6 431 uint32_t wifi_observed_tx_bitrate[IF_INTERFACE_ADVISORY_WIFI_TX_QUEUE_COUNT]; 432 }; 433 434 /* 435 * This structure is used to define the parameters for advisory notifications 436 * that are specific for Cellular interface. 437 */ 438 struct ifnet_interface_advisory_cell_context { 439 /* 440 * Radio Access Technology 441 */ 442 uint8_t radio_access_technology; 443 /* 444 * Received Reference Signal Received level (RSRP dBm) 445 */ 446 int16_t reference_signal_level; 447 /* 448 * Received Signal strength level (RSSI dBm) 449 */ 450 int16_t signal_level; 451 /* 452 * Received signal quality (SNR dB). 453 */ 454 int8_t signal_quality; 455 /* 456 * Uplink Block Error Rate % 457 */ 458 uint8_t uplink_bler; 459 /* 460 * Downlink Block Error Rate % 461 */ 462 uint8_t downlink_bler; 463 /* 464 * Bandwidth Limitation Type. I.e. TTI-B. 465 */ 466 uint8_t bandwidth_limitation_indication; 467 /* 468 * Discontinuous reception state: CDRX on/off. 469 */ 470 uint8_t cdrx_state; 471 /* 472 * Discontinuous reception cycle in ms. 473 */ 474 uint16_t cdrx_cycle; 475 /* 476 * Approximate outage period when not known 477 */ 478 uint16_t estimated_outage_period; 479 /* 480 * Cellular outage state: i.e. handover in progress. 481 * 0 - no outage 482 * 1 - outage. 483 */ 484 #define IF_INTERFACE_ADVISORY_CELL_OUTAGE_STATE_NO 0 485 #define IF_INTERFACE_ADVISORY_CELL_OUTAGE_STATE_YES 1 486 uint8_t outage_state; 487 /* 488 * padding for alignment. 489 */ 490 uint8_t __pad; 491 }; 492 493 struct ifnet_interface_advisory { 494 union { 495 struct { /* version 1 structure (to be deprecated) */ 496 /* The current structure version */ 497 uint8_t version; 498 /* Specifies if the advisory is for transmit or receive path */ 499 uint8_t direction; 500 /* reserved for future use */ 501 uint16_t _reserved; 502 /* 503 * suggestion for data rate change to keep the latency low. 504 * unit: bits per second (bps) 505 * NOTE: if the interface cannot provide suggestions in terms of bps, 506 * it should use the following values: 507 * INT32_MAX : ramp up 508 * INT32_MIN : ramp down 509 * 0 : neutral 510 */ 511 int32_t rate_trend_suggestion; 512 /* 513 * Time of the issue of advisory. 514 * Timestamp should be in the host domain. 515 * unit: mach absolute time 516 */ 517 uint64_t timestamp; 518 /* 519 * Maximum theoretical bandwidth of the interface. 520 * unit: bits per second (bps) 521 */ 522 uint64_t max_bandwidth; 523 /* 524 * Total bytes sent or received on the interface. 525 * wrap around possible and the application should account for that. 526 * unit: byte 527 */ 528 uint64_t total_byte_count; 529 /* 530 * average throughput observed at the driver stack. 531 * unit: bits per second (bps) 532 */ 533 uint64_t average_throughput; 534 /* 535 * flushable queue size at the driver. 536 * should be set to UINT32_MAX if not available. 537 * unit: byte 538 */ 539 uint32_t flushable_queue_size; 540 /* 541 * non flushable queue size at the driver. 542 * should be set to UINT32_MAX if not available. 543 * unit: byte 544 */ 545 uint32_t non_flushable_queue_size; 546 /* 547 * average delay observed at the interface. 548 * unit: milliseconds (ms) 549 */ 550 uint32_t average_delay; 551 /* 552 * Current frequency band (enumeration). 553 */ 554 uint8_t frequency_band; 555 /* 556 * Intermittent WiFi state [true(1)/false(0)] 557 */ 558 uint8_t intermittent_state; 559 /* 560 * Estimated period for which intermittent state is expected to last. 561 * 1 tick -> 1 ms UNDEF => UINT16_MAX 562 */ 563 uint16_t estimated_intermittent_period; 564 /* 565 * Expected wifi outage period during intermittent state 566 * 1 tick -> 1 ms UNDEF => UINT16_MAX 567 */ 568 uint16_t single_outage_period; 569 570 /* 571 * WiFi-BT coexistence, 1-ON, 0-OFF 572 */ 573 uint8_t bt_coex; 574 /* 575 * on scale of 1 to 5 576 */ 577 uint8_t quality_score_delay; 578 /* 579 * on scale of 1 to 5 580 */ 581 uint8_t quality_score_loss; 582 /* 583 * on scale of 1 to 5 584 */ 585 uint8_t quality_score_channel; 586 }; 587 588 struct { /* version 2 structure */ 589 struct ifnet_interface_advisory_header header; 590 struct ifnet_interface_advisory_capacity capacity; 591 union { 592 struct ifnet_interface_advisory_wifi_context wifi_context; 593 struct ifnet_interface_advisory_cell_context cell_context; 594 }; 595 }; 596 }; 597 } __attribute__((aligned(sizeof(uint64_t)))); 598 #pragma pack(pop) 599 600 /* 601 * Definitions related to traffic steering 602 */ 603 #pragma pack(push, 1) 604 605 /* Supported types */ 606 /* Reserving 1 for link layer */ 607 #define IFNET_TRAFFIC_DESCRIPTOR_TYPE_INET 2 608 609 /* Supported flags */ 610 #define IFNET_TRAFFIC_DESCRIPTOR_FLAG_INBOUND 0x0001 611 #define IFNET_TRAFFIC_DESCRIPTOR_FLAG_OUTBOUND 0x0002 612 613 struct ifnet_traffic_descriptor_common { 614 uint8_t itd_type; 615 uint8_t _reserved; 616 uint16_t itd_len; /* length of entire struct (common + td-specific) */ 617 uint32_t itd_flags; 618 }; 619 620 #define IFNET_TRAFFIC_DESCRIPTOR_INET_IPVER 0x01 621 #define IFNET_TRAFFIC_DESCRIPTOR_INET_PROTO 0x02 622 #define IFNET_TRAFFIC_DESCRIPTOR_INET_LADDR 0x04 623 #define IFNET_TRAFFIC_DESCRIPTOR_INET_RADDR 0x08 624 #define IFNET_TRAFFIC_DESCRIPTOR_INET_LPORT 0x10 625 #define IFNET_TRAFFIC_DESCRIPTOR_INET_RPORT 0x20 626 627 struct ifnet_ip_addr { 628 union { 629 uint8_t addr8[16]; 630 uint16_t addr16[8]; 631 uint32_t addr32[4]; 632 }; 633 }; 634 #define iia_v4addr addr32[3] 635 636 struct ifnet_traffic_descriptor_inet { 637 struct ifnet_traffic_descriptor_common inet_common; 638 uint8_t inet_mask; 639 uint8_t inet_ipver; /* IPVERSION or IPV6_VERSION */ 640 uint8_t inet_proto; /* IPPROTO_TCP or IPPROTO_UDP */ 641 uint8_t _reserved; 642 struct ifnet_ip_addr inet_laddr; 643 struct ifnet_ip_addr inet_raddr; 644 uint16_t inet_lport; 645 uint16_t inet_rport; 646 }; 647 648 #define IFNET_TRAFFIC_RULE_ACTION_STEER 1 649 struct ifnet_traffic_rule_action { 650 uint8_t ra_type; 651 uint8_t _reserved; 652 uint16_t ra_len; 653 }; 654 655 struct ifnet_traffic_rule_action_steer { 656 struct ifnet_traffic_rule_action ras_common; 657 uint64_t ras_qset_id; 658 }; 659 #pragma pack(pop) 660 661 #pragma pack() 662 663 #endif /* !_NET_IF_VAR_STATUS_H_ */ 664