X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/39236c6e673c41db228275375ab7fdb0f837b292..4d15aeb193b2c68f1d38666c317f8d3734f5f083:/bsd/net/if.h?ds=sidebyside diff --git a/bsd/net/if.h b/bsd/net/if.h index 0de578479..9d93391f4 100644 --- a/bsd/net/if.h +++ b/bsd/net/if.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2013 Apple Inc. All rights reserved. + * Copyright (c) 2000-2016 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -64,44 +64,13 @@ #define _NET_IF_H_ #include +#include #define IF_NAMESIZE 16 #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #include #ifdef __APPLE__ -/* - * Define Data-Link event subclass, and associated - * events. - */ - -#define KEV_DL_SUBCLASS 2 - -#define KEV_DL_SIFFLAGS 1 -#define KEV_DL_SIFMETRICS 2 -#define KEV_DL_SIFMTU 3 -#define KEV_DL_SIFPHYS 4 -#define KEV_DL_SIFMEDIA 5 -#define KEV_DL_SIFGENERIC 6 -#define KEV_DL_ADDMULTI 7 -#define KEV_DL_DELMULTI 8 -#define KEV_DL_IF_ATTACHED 9 -#define KEV_DL_IF_DETACHING 10 -#define KEV_DL_IF_DETACHED 11 -#define KEV_DL_LINK_OFF 12 -#define KEV_DL_LINK_ON 13 -#define KEV_DL_PROTO_ATTACHED 14 -#define KEV_DL_PROTO_DETACHED 15 -#define KEV_DL_LINK_ADDRESS_CHANGED 16 -#define KEV_DL_WAKEFLAGS_CHANGED 17 -#define KEV_DL_IF_IDLE_ROUTE_REFCNT 18 -#define KEV_DL_IFCAP_CHANGED 19 -#define KEV_DL_LINK_QUALITY_METRIC_CHANGED 20 -#define KEV_DL_NODE_PRESENCE 21 -#define KEV_DL_NODE_ABSENCE 22 -#define KEV_DL_MASTER_ELECTED 23 -#define KEV_DL_ISSUES 24 -#define KEV_DL_IFDELEGATE_CHANGED 25 #include #include @@ -110,7 +79,8 @@ #ifdef PRIVATE #include #include -#endif +#include +#endif /* PRIVATE */ #endif struct if_clonereq { @@ -155,29 +125,53 @@ struct if_clonereq32 { #ifdef PRIVATE /* extended flags definitions: (all bits reserved for internal/future use) */ -#define IFEF_AUTOCONFIGURING 0x1 /* allow BOOTP/DHCP replies to enter */ -#define IFEF_IPV6_DISABLED 0x20 /* coupled to ND6_IFF_IFDISABLED */ -#define IFEF_ACCEPT_RTADV 0x40 /* accepts IPv6 RA on the interface */ -#define IFEF_TXSTART 0x80 /* has start callback */ -#define IFEF_RXPOLL 0x100 /* supports opportunistic input poll */ -#define IFEF_VLAN 0x200 /* interface has one or more vlans */ -#define IFEF_BOND 0x400 /* interface is part of bond */ -#define IFEF_ARPLL 0x800 /* ARP for IPv4LL addresses */ -#define IFEF_NOWINDOWSCALE 0x1000 /* Don't scale TCP window on iface */ -#define IFEF_NOAUTOIPV6LL 0x2000 /* Need explicit IPv6 LL address */ -#define IFEF_IPV4_ROUTER 0x8000 /* interior when in IPv4 router mode */ -#define IFEF_IPV6_ROUTER 0x10000 /* interior when in IPv6 router mode */ -#define IFEF_LOCALNET_PRIVATE 0x20000 /* local private network */ +#define IFEF_AUTOCONFIGURING 0x00000001 /* allow BOOTP/DHCP replies to enter */ +#define IFEF_ENQUEUE_MULTI 0x00000002 /* enqueue multiple packets at once */ +#define IFEF_DELAY_START 0x00000004 /* delay start callback */ +#define IFEF_PROBE_CONNECTIVITY 0x00000008 /* Probe connections going over this interface */ +#define IFEF_QOSMARKING_CAPABLE 0x00000010 /* XXX Obsolete, to be removed */ +#define IFEF_IPV6_DISABLED 0x00000020 /* coupled to ND6_IFF_IFDISABLED */ +#define IFEF_ACCEPT_RTADV 0x00000040 /* accepts IPv6 RA on the interface */ +#define IFEF_TXSTART 0x00000080 /* has start callback */ +#define IFEF_RXPOLL 0x00000100 /* supports opportunistic input poll */ +#define IFEF_VLAN 0x00000200 /* interface has one or more vlans */ +#define IFEF_BOND 0x00000400 /* interface is part of bond */ +#define IFEF_ARPLL 0x00000800 /* ARP for IPv4LL addresses */ +/* #define IFEF_NOWINDOWSCALE 0x00001000 */ /* Don't scale TCP window on iface */ +/* + * XXX IFEF_NOAUTOIPV6LL is deprecated and should be done away with. + * Configd pretty much manages the interface configuration. + * Rather than looking at the flag we check if a specific LLA + * has to be configured or the IID has to be generated by kernel. + */ +#define IFEF_NOAUTOIPV6LL 0x00002000 /* Need explicit IPv6 LL address */ +#define IFEF_EXPENSIVE 0x00004000 /* Data access has a cost */ +#define IFEF_IPV4_ROUTER 0x00008000 /* interior when in IPv4 router mode */ +#define IFEF_IPV6_ROUTER 0x00010000 /* interior when in IPv6 router mode */ +#define IFEF_LOCALNET_PRIVATE 0x00020000 /* local private network */ #define IFEF_SERVICE_TRIGGERED IFEF_LOCALNET_PRIVATE -#define IFEF_IPV6_ND6ALT 0x40000 /* alternative. KPI for ND6 */ -#define IFEF_RESTRICTED_RECV 0x80000 /* interface restricts inbound pkts */ -#define IFEF_AWDL 0x100000 /* Apple Wireless Direct Link */ -#define IFEF_NOACKPRI 0x200000 /* No TCP ACK prioritization */ +#define IFEF_IPV6_ND6ALT 0x00040000 /* alternative. KPI for ND6 */ +#define IFEF_RESTRICTED_RECV 0x00080000 /* interface restricts inbound pkts */ +#define IFEF_AWDL 0x00100000 /* Apple Wireless Direct Link */ +#define IFEF_NOACKPRI 0x00200000 /* No TCP ACK prioritization */ +#define IFEF_AWDL_RESTRICTED 0x00400000 /* Restricted AWDL mode */ +#define IFEF_2KCL 0x00800000 /* prefers 2K cluster (socket based tunnel) */ +#define IFEF_ECN_ENABLE 0x01000000 /* use ECN for TCP connections on the interface */ +#define IFEF_ECN_DISABLE 0x02000000 /* do not use ECN for TCP connections on the interface */ +#define IFEF_SKYWALK_NATIVE 0x04000000 /* Native Skywalk support */ +#define IFEF_3CA 0x08000000 /* Capable of 3CA */ #define IFEF_SENDLIST 0x10000000 /* Supports tx packet lists */ #define IFEF_DIRECTLINK 0x20000000 /* point-to-point topology */ -#define _IFEF_INUSE 0x40000000 /* deprecated */ +#define IFEF_QOSMARKING_ENABLED 0x40000000 /* OoS marking is enabled */ #define IFEF_UPDOWNCHANGE 0x80000000 /* up/down state is changing */ + #ifdef XNU_KERNEL_PRIVATE +/* + * Extra flags + */ +#define IFXF_WAKE_ON_MAGIC_PACKET 0x00000001 /* wake on magic packet */ +#define IFXF_TIMESTAMP_ENABLED 0x00000002 /* time stamping enabled */ + /* * Current requirements for an AWDL interface. Setting/clearing IFEF_AWDL * will also trigger the setting/clearing of the rest of the flags. Once @@ -236,15 +230,21 @@ struct if_clonereq32 { #define IFCAP_LRO 0x00080 /* can do Large Receive Offload */ #define IFCAP_AV 0x00100 /* can do 802.1 AV Bridging */ #define IFCAP_TXSTATUS 0x00200 /* can return linklevel xmit status */ +#define IFCAP_SKYWALK 0x00400 /* Skywalk mode supported/enabled */ +#define IFCAP_HW_TIMESTAMP 0x00800 /* Time stamping in hardware */ +#define IFCAP_SW_TIMESTAMP 0x01000 /* Time stamping in software */ #define IFCAP_HWCSUM (IFCAP_RXCSUM | IFCAP_TXCSUM) #define IFCAP_TSO (IFCAP_TSO4 | IFCAP_TSO6) #define IFCAP_VALID (IFCAP_HWCSUM | IFCAP_TSO | IFCAP_LRO | IFCAP_VLAN_MTU | \ - IFCAP_VLAN_HWTAGGING | IFCAP_JUMBO_MTU | IFCAP_AV | IFCAP_TXSTATUS) + IFCAP_VLAN_HWTAGGING | IFCAP_JUMBO_MTU | IFCAP_AV | IFCAP_TXSTATUS | \ + IFCAP_SKYWALK | IFCAP_SW_TIMESTAMP | IFCAP_HW_TIMESTAMP) #define IFQ_MAXLEN 128 -#define IFNET_SLOWHZ 1 /* granularity is 1 second */ +#define IFNET_SLOWHZ 1 /* granularity is 1 second */ +#define IFQ_TARGET_DELAY (10ULL * 1000 * 1000) /* 10 ms */ +#define IFQ_UPDATE_INTERVAL (100ULL * 1000 * 1000) /* 100 ms */ /* * Message format for use in obtaining information about interfaces @@ -457,7 +457,35 @@ struct ifreq { #define IFRTYPE_SUBFAMILY_BLUETOOTH 2 #define IFRTYPE_SUBFAMILY_WIFI 3 #define IFRTYPE_SUBFAMILY_THUNDERBOLT 4 +#define IFRTYPE_SUBFAMILY_RESERVED 5 +#define IFRTYPE_SUBFAMILY_INTCOPROC 6 } ifru_type; + u_int32_t ifru_functional_type; +#define IFRTYPE_FUNCTIONAL_UNKNOWN 0 +#define IFRTYPE_FUNCTIONAL_LOOPBACK 1 +#define IFRTYPE_FUNCTIONAL_WIRED 2 +#define IFRTYPE_FUNCTIONAL_WIFI_INFRA 3 +#define IFRTYPE_FUNCTIONAL_WIFI_AWDL 4 +#define IFRTYPE_FUNCTIONAL_CELLULAR 5 +#define IFRTYPE_FUNCTIONAL_INTCOPROC 6 +#define IFRTYPE_FUNCTIONAL_LAST 6 + u_int32_t ifru_expensive; + u_int32_t ifru_2kcl; + struct { + u_int32_t qlen; + u_int32_t timeout; + } ifru_start_delay; + struct if_interface_state ifru_interface_state; + u_int32_t ifru_probe_connectivity; + u_int32_t ifru_ecn_mode; +#define IFRTYPE_ECN_DEFAULT 0 +#define IFRTYPE_ECN_ENABLE 1 +#define IFRTYPE_ECN_DISABLE 2 + u_int32_t ifru_qosmarking_mode; +#define IFRTYPE_QOSMARKING_MODE_NONE 0 +#define IFRTYPE_QOSMARKING_FASTLANE 1 + u_int32_t ifru_qosmarking_enabled; + u_int32_t ifru_disable_output; #endif /* PRIVATE */ } ifr_ifru; #define ifr_addr ifr_ifru.ifru_addr /* address */ @@ -492,7 +520,21 @@ struct ifreq { #define ifr_eflags ifr_ifru.ifru_eflags /* extended flags */ #define ifr_log ifr_ifru.ifru_log /* logging level/flags */ #define ifr_delegated ifr_ifru.ifru_delegated /* delegated interface index */ +#define ifr_expensive ifr_ifru.ifru_expensive #define ifr_type ifr_ifru.ifru_type /* interface type */ +#define ifr_functional_type ifr_ifru.ifru_functional_type +#define ifr_2kcl ifr_ifru.ifru_2kcl +#define ifr_start_delay_qlen ifr_ifru.ifru_start_delay.qlen +#define ifr_start_delay_timeout ifr_ifru.ifru_start_delay.timeout +#define ifr_interface_state ifr_ifru.ifru_interface_state +#define ifr_probe_connectivity ifr_ifru.ifru_probe_connectivity +#define ifr_ecn_mode ifr_ifru.ifru_ecn_mode +#define ifr_qosmarking_mode ifr_ifru.ifru_qosmarking_mode +#define ifr_fastlane_capable ifr_qosmarking_mode +#define ifr_qosmarking_enabled ifr_ifru.ifru_qosmarking_enabled +#define ifr_fastlane_enabled ifr_qosmarking_enabled +#define ifr_disable_output ifr_ifru.ifru_disable_output + #endif /* PRIVATE */ }; @@ -641,30 +683,20 @@ struct kev_dl_proto_data { u_int32_t proto_remaining_count; }; -/* - * Structure for SIOC[AGD]LIFADDR - */ -struct if_laddrreq { - char iflr_name[IFNAMSIZ]; - unsigned int flags; -#define IFLR_PREFIX 0x8000 /* in: prefix given out: kernel fills id */ - unsigned int prefixlen; /* in/out */ - struct sockaddr_storage addr; /* in/out */ - struct sockaddr_storage dstaddr; /* out */ -}; - #ifdef PRIVATE /* * Link Quality Metrics * * IFNET_LQM_THRESH_OFF Metric is not available; device is off. * IFNET_LQM_THRESH_UNKNOWN Metric is not (yet) known. + * IFNET_LQM_THRESH_BAD Link quality is considered bad by driver. * IFNET_LQM_THRESH_POOR Link quality is considered poor by driver. * IFNET_LQM_THRESH_GOOD Link quality is considered good by driver. */ enum { IFNET_LQM_THRESH_OFF = (-2), IFNET_LQM_THRESH_UNKNOWN = (-1), + IFNET_LQM_THRESH_BAD = 10, IFNET_LQM_THRESH_POOR = 50, IFNET_LQM_THRESH_GOOD = 100 }; @@ -709,8 +741,9 @@ struct if_descreq { enum { IFNET_SCHED_MODEL_NORMAL = 0, IFNET_SCHED_MODEL_DRIVER_MANAGED = 1, + IFNET_SCHED_MODEL_FQ_CODEL = 2, #ifdef XNU_KERNEL_PRIVATE - IFNET_SCHED_MODEL_MAX = 2, + IFNET_SCHED_MODEL_MAX = 3, #endif /* XNU_KERNEL_PRIVATE */ }; @@ -814,6 +847,36 @@ enum { #endif /* XNU_KERNEL_PRIVATE */ }; +/* + * Structure for SIOC[A/D]IFAGENTID + */ +struct if_agentidreq { + char ifar_name[IFNAMSIZ]; /* interface name */ + uuid_t ifar_uuid; /* agent UUID to add or delete */ +}; + +/* + * Structure for SIOCGIFAGENTIDS + */ +struct if_agentidsreq { + char ifar_name[IFNAMSIZ]; /* interface name */ + u_int32_t ifar_count; /* number of agent UUIDs */ + uuid_t *ifar_uuids; /* array of agent UUIDs */ +}; + +#ifdef BSD_KERNEL_PRIVATE +struct if_agentidsreq32 { + char ifar_name[IFNAMSIZ]; + u_int32_t ifar_count; + user32_addr_t ifar_uuids; +}; +struct if_agentidsreq64 { + char ifar_name[IFNAMSIZ]; + u_int32_t ifar_count; + user64_addr_t ifar_uuids __attribute__((aligned(8))); +}; +#endif /* BSD_KERNEL_PRIVATE */ + #define DLIL_MODIDLEN 20 /* same as IFNET_MODIDLEN */ #define DLIL_MODARGLEN 12 /* same as IFNET_MODARGLEN */ @@ -826,6 +889,71 @@ struct kev_dl_issues { u_int64_t timestamp; u_int8_t info[DLIL_MODARGLEN]; }; + +/* + * DLIL KEV_DL_RRC_STATE_CHANGED structure + */ +struct kev_dl_rrc_state { + struct net_event_data link_data; + u_int32_t rrc_state; +}; + +/* + * Length of network signature/fingerprint blob. + */ +#define IFNET_SIGNATURELEN 20 + +/* + * Structure for SIOC[S/G]IFNETSIGNATURE + */ +struct if_nsreq { + char ifnsr_name[IFNAMSIZ]; + u_int8_t ifnsr_family; /* address family */ + u_int8_t ifnsr_len; /* data length */ + u_int16_t ifnsr_flags; /* for future */ + u_int8_t ifnsr_data[IFNET_SIGNATURELEN]; +}; + +/* + * Structure for SIOC[S/G]IFORDER + * + * When setting, ifo_count is the number of u_int32_t interface indices + * in the ifo_ordered_indices array. + * + * When getting, if ifo_count is 0, the length of the ordered list will + * be returned. If the ifo_count is non-0, it is the number of u_int32_t + * interface indices allocated. Upon return, ifo_count will contain the number + * of indices copied into the array. + */ +struct if_order { + u_int32_t ifo_count; + u_int32_t ifo_reserved; + mach_vm_address_t ifo_ordered_indices; /* array of u_int32_t */ +}; + +/* + * Struct for traffic class to DSCP mapping + */ +struct if_tdmreq { + char iftdm_name[IFNAMSIZ]; + u_int32_t iftdm_len; /* byte length of the table */ + struct netsvctype_dscp_map *iftdm_table; +}; + +#ifdef BSD_KERNEL_PRIVATE +struct if_tdmreq32 { + char iftdm_name[IFNAMSIZ]; + u_int32_t iftdm_len; /* byte length of the table */ + user32_addr_t iftdm_table; +}; + +struct if_tdmreq64 { + char iftdm_name[IFNAMSIZ]; + u_int32_t iftdm_len; /* byte length of the table */ + user64_addr_t iftdm_table __attribute__((aligned(8))); +}; +#endif + #endif /* PRIVATE */ #ifdef KERNEL