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