]>
Commit | Line | Data |
---|---|---|
1c79356b | 1 | /* |
fe8ab488 | 2 | * Copyright (c) 2000-2014 Apple Inc. All rights reserved. |
5d5c5d0d | 3 | * |
2d21ac55 | 4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ |
39236c6e | 5 | * |
2d21ac55 A |
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. | |
39236c6e | 14 | * |
2d21ac55 A |
15 | * Please obtain a copy of the License at |
16 | * http://www.opensource.apple.com/apsl/ and read it before using this file. | |
39236c6e | 17 | * |
2d21ac55 A |
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 | |
8f6c56a5 A |
20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
2d21ac55 A |
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. | |
39236c6e | 25 | * |
2d21ac55 | 26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ |
1c79356b A |
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 | |
9bccf70c | 61 | * $FreeBSD: src/sys/net/if_var.h,v 1.18.2.7 2001/07/24 19:10:18 brooks Exp $ |
1c79356b A |
62 | */ |
63 | ||
64 | #ifndef _NET_IF_VAR_H_ | |
65 | #define _NET_IF_VAR_H_ | |
91447636 | 66 | |
9bccf70c | 67 | #include <sys/appleapiopts.h> |
b0d623f7 | 68 | #include <stdint.h> |
91447636 A |
69 | #include <sys/types.h> |
70 | #include <sys/time.h> | |
71 | #include <sys/queue.h> /* get TAILQ macros */ | |
72 | #ifdef KERNEL_PRIVATE | |
73 | #include <kern/locks.h> | |
74 | #endif /* KERNEL_PRIVATE */ | |
b0d623f7 A |
75 | #ifdef PRIVATE |
76 | #include <net/route.h> | |
77 | #endif | |
91447636 A |
78 | |
79 | #ifdef KERNEL | |
80 | #include <net/kpi_interface.h> | |
b0d623f7 | 81 | #endif /* KERNEL */ |
1c79356b | 82 | |
9bccf70c | 83 | #ifdef __APPLE__ |
1c79356b A |
84 | #define APPLE_IF_FAM_LOOPBACK 1 |
85 | #define APPLE_IF_FAM_ETHERNET 2 | |
86 | #define APPLE_IF_FAM_SLIP 3 | |
87 | #define APPLE_IF_FAM_TUN 4 | |
88 | #define APPLE_IF_FAM_VLAN 5 | |
89 | #define APPLE_IF_FAM_PPP 6 | |
90 | #define APPLE_IF_FAM_PVC 7 | |
91 | #define APPLE_IF_FAM_DISC 8 | |
92 | #define APPLE_IF_FAM_MDECAP 9 | |
93 | #define APPLE_IF_FAM_GIF 10 | |
316670eb | 94 | #define APPLE_IF_FAM_FAITH 11 /* deprecated */ |
55e303ae A |
95 | #define APPLE_IF_FAM_STF 12 |
96 | #define APPLE_IF_FAM_FIREWIRE 13 | |
91447636 | 97 | #define APPLE_IF_FAM_BOND 14 |
0c530ab8 | 98 | #endif /* __APPLE__ */ |
91447636 A |
99 | |
100 | /* | |
101 | * 72 was chosen below because it is the size of a TCP/IP | |
102 | * header (40) + the minimum mss (32). | |
103 | */ | |
104 | #define IF_MINMTU 72 | |
105 | #define IF_MAXMTU 65535 | |
1c79356b A |
106 | |
107 | /* | |
108 | * Structures defining a network interface, providing a packet | |
109 | * transport mechanism (ala level 0 of the PUP protocols). | |
110 | * | |
111 | * Each interface accepts output datagrams of a specified maximum | |
112 | * length, and provides higher level routines with input datagrams | |
113 | * received from its medium. | |
114 | * | |
115 | * Output occurs when the routine if_output is called, with three parameters: | |
116 | * (*ifp->if_output)(ifp, m, dst, rt) | |
117 | * Here m is the mbuf chain to be sent and dst is the destination address. | |
118 | * The output routine encapsulates the supplied datagram if necessary, | |
119 | * and then transmits it on its medium. | |
120 | * | |
121 | * On input, each interface unwraps the data received by it, and either | |
122 | * places it on the input queue of a internetwork datagram routine | |
123 | * and posts the associated software interrupt, or passes the datagram to a raw | |
124 | * packet input routine. | |
125 | * | |
126 | * Routines exist for locating interfaces by their addresses | |
127 | * or for locating a interface on a certain network, as well as more general | |
128 | * routing and gateway routines maintaining information used to locate | |
129 | * interfaces. These routines live in the files if.c and route.c | |
130 | */ | |
131 | ||
1c79356b A |
132 | #define IFNAMSIZ 16 |
133 | ||
1c79356b A |
134 | /* This belongs up in socket.h or socketvar.h, depending on how far the |
135 | * event bubbles up. | |
136 | */ | |
137 | ||
138 | struct net_event_data { | |
2d21ac55 A |
139 | u_int32_t if_family; |
140 | u_int32_t if_unit; | |
141 | char if_name[IFNAMSIZ]; | |
1c79356b | 142 | }; |
1c79356b | 143 | |
2d21ac55 | 144 | #if defined(__LP64__) |
39236c6e | 145 | #include <sys/_types/_timeval32.h> |
2d21ac55 A |
146 | #define IF_DATA_TIMEVAL timeval32 |
147 | #else | |
148 | #define IF_DATA_TIMEVAL timeval | |
149 | #endif | |
150 | ||
151 | #pragma pack(4) | |
152 | ||
91447636 A |
153 | /* |
154 | * Structure describing information about an interface | |
155 | * which may be of interest to management entities. | |
156 | */ | |
157 | struct if_data { | |
158 | /* generic interface information */ | |
2d21ac55 A |
159 | u_char ifi_type; /* ethernet, tokenring, etc */ |
160 | u_char ifi_typelen; /* Length of frame type id */ | |
161 | u_char ifi_physical; /* e.g., AUI, Thinnet, 10base-T, etc */ | |
162 | u_char ifi_addrlen; /* media address length */ | |
163 | u_char ifi_hdrlen; /* media header length */ | |
164 | u_char ifi_recvquota; /* polling quota for receive intrs */ | |
165 | u_char ifi_xmitquota; /* polling quota for xmit intrs */ | |
166 | u_char ifi_unused1; /* for future use */ | |
167 | u_int32_t ifi_mtu; /* maximum transmission unit */ | |
168 | u_int32_t ifi_metric; /* routing metric (external only) */ | |
169 | u_int32_t ifi_baudrate; /* linespeed */ | |
91447636 | 170 | /* volatile statistics */ |
2d21ac55 A |
171 | u_int32_t ifi_ipackets; /* packets received on interface */ |
172 | u_int32_t ifi_ierrors; /* input errors on interface */ | |
173 | u_int32_t ifi_opackets; /* packets sent on interface */ | |
174 | u_int32_t ifi_oerrors; /* output errors on interface */ | |
175 | u_int32_t ifi_collisions; /* collisions on csma interfaces */ | |
176 | u_int32_t ifi_ibytes; /* total number of octets received */ | |
177 | u_int32_t ifi_obytes; /* total number of octets sent */ | |
178 | u_int32_t ifi_imcasts; /* packets received via multicast */ | |
179 | u_int32_t ifi_omcasts; /* packets sent via multicast */ | |
180 | u_int32_t ifi_iqdrops; /* dropped on input, this interface */ | |
181 | u_int32_t ifi_noproto; /* destined for unsupported protocol */ | |
182 | u_int32_t ifi_recvtiming; /* usec spent receiving when timing */ | |
183 | u_int32_t ifi_xmittiming; /* usec spent xmitting when timing */ | |
184 | struct IF_DATA_TIMEVAL ifi_lastchange; /* time of last administrative change */ | |
185 | u_int32_t ifi_unused2; /* used to be the default_proto */ | |
186 | u_int32_t ifi_hwassist; /* HW offload capabilities */ | |
187 | u_int32_t ifi_reserved1; /* for future use */ | |
188 | u_int32_t ifi_reserved2; /* for future use */ | |
91447636 | 189 | }; |
4a249263 | 190 | |
1c79356b A |
191 | /* |
192 | * Structure describing information about an interface | |
193 | * which may be of interest to management entities. | |
194 | */ | |
91447636 | 195 | struct if_data64 { |
1c79356b | 196 | /* generic interface information */ |
2d21ac55 A |
197 | u_char ifi_type; /* ethernet, tokenring, etc */ |
198 | u_char ifi_typelen; /* Length of frame type id */ | |
91447636 A |
199 | u_char ifi_physical; /* e.g., AUI, Thinnet, 10base-T, etc */ |
200 | u_char ifi_addrlen; /* media address length */ | |
201 | u_char ifi_hdrlen; /* media header length */ | |
202 | u_char ifi_recvquota; /* polling quota for receive intrs */ | |
203 | u_char ifi_xmitquota; /* polling quota for xmit intrs */ | |
204 | u_char ifi_unused1; /* for future use */ | |
2d21ac55 A |
205 | u_int32_t ifi_mtu; /* maximum transmission unit */ |
206 | u_int32_t ifi_metric; /* routing metric (external only) */ | |
91447636 A |
207 | u_int64_t ifi_baudrate; /* linespeed */ |
208 | /* volatile statistics */ | |
209 | u_int64_t ifi_ipackets; /* packets received on interface */ | |
210 | u_int64_t ifi_ierrors; /* input errors on interface */ | |
211 | u_int64_t ifi_opackets; /* packets sent on interface */ | |
212 | u_int64_t ifi_oerrors; /* output errors on interface */ | |
213 | u_int64_t ifi_collisions; /* collisions on csma interfaces */ | |
214 | u_int64_t ifi_ibytes; /* total number of octets received */ | |
215 | u_int64_t ifi_obytes; /* total number of octets sent */ | |
216 | u_int64_t ifi_imcasts; /* packets received via multicast */ | |
217 | u_int64_t ifi_omcasts; /* packets sent via multicast */ | |
218 | u_int64_t ifi_iqdrops; /* dropped on input, this interface */ | |
219 | u_int64_t ifi_noproto; /* destined for unsupported protocol */ | |
2d21ac55 A |
220 | u_int32_t ifi_recvtiming; /* usec spent receiving when timing */ |
221 | u_int32_t ifi_xmittiming; /* usec spent xmitting when timing */ | |
222 | struct IF_DATA_TIMEVAL ifi_lastchange; /* time of last administrative change */ | |
91447636 A |
223 | }; |
224 | ||
225 | #ifdef PRIVATE | |
d41d1dae | 226 | struct if_traffic_class { |
316670eb A |
227 | u_int64_t ifi_ibepackets; /* TC_BE packets received on interface */ |
228 | u_int64_t ifi_ibebytes; /* TC_BE bytes received on interface */ | |
229 | u_int64_t ifi_obepackets; /* TC_BE packet sent on interface */ | |
230 | u_int64_t ifi_obebytes; /* TC_BE bytes sent on interface */ | |
d41d1dae A |
231 | u_int64_t ifi_ibkpackets; /* TC_BK packets received on interface */ |
232 | u_int64_t ifi_ibkbytes; /* TC_BK bytes received on interface */ | |
233 | u_int64_t ifi_obkpackets; /* TC_BK packet sent on interface */ | |
234 | u_int64_t ifi_obkbytes; /* TC_BK bytes sent on interface */ | |
235 | u_int64_t ifi_ivipackets; /* TC_VI packets received on interface */ | |
236 | u_int64_t ifi_ivibytes; /* TC_VI bytes received on interface */ | |
237 | u_int64_t ifi_ovipackets; /* TC_VI packets sent on interface */ | |
238 | u_int64_t ifi_ovibytes; /* TC_VI bytes sent on interface */ | |
239 | u_int64_t ifi_ivopackets; /* TC_VO packets received on interface */ | |
240 | u_int64_t ifi_ivobytes; /* TC_VO bytes received on interface */ | |
241 | u_int64_t ifi_ovopackets; /* TC_VO packets sent on interface */ | |
242 | u_int64_t ifi_ovobytes; /* TC_VO bytes sent on interface */ | |
316670eb A |
243 | u_int64_t ifi_ipvpackets; /* TC priv packets received on interface */ |
244 | u_int64_t ifi_ipvbytes; /* TC priv bytes received on interface */ | |
245 | u_int64_t ifi_opvpackets; /* TC priv packets sent on interface */ | |
246 | u_int64_t ifi_opvbytes; /* TC priv bytes sent on interface */ | |
247 | }; | |
248 | ||
249 | struct if_data_extended { | |
250 | u_int64_t ifi_alignerrs; /* unaligned (32-bit) input pkts */ | |
39236c6e A |
251 | u_int64_t ifi_dt_bytes; /* Data threshold counter */ |
252 | u_int64_t ifi_fpackets; /* forwarded packets on interface */ | |
253 | u_int64_t ifi_fbytes; /* forwarded bytes on interface */ | |
254 | u_int64_t reserved[12]; /* for future */ | |
316670eb A |
255 | }; |
256 | ||
257 | struct if_packet_stats { | |
258 | /* TCP */ | |
259 | u_int64_t ifi_tcp_badformat; | |
260 | u_int64_t ifi_tcp_unspecv6; | |
261 | u_int64_t ifi_tcp_synfin; | |
262 | u_int64_t ifi_tcp_badformatipsec; | |
263 | u_int64_t ifi_tcp_noconnnolist; | |
264 | u_int64_t ifi_tcp_noconnlist; | |
265 | u_int64_t ifi_tcp_listbadsyn; | |
266 | u_int64_t ifi_tcp_icmp6unreach; | |
267 | u_int64_t ifi_tcp_deprecate6; | |
268 | u_int64_t ifi_tcp_rstinsynrcv; | |
269 | u_int64_t ifi_tcp_ooopacket; | |
270 | u_int64_t ifi_tcp_dospacket; | |
271 | u_int64_t ifi_tcp_cleanup; | |
272 | u_int64_t ifi_tcp_synwindow; | |
39236c6e | 273 | u_int64_t reserved[6]; |
316670eb A |
274 | /* UDP */ |
275 | u_int64_t ifi_udp_port_unreach; | |
276 | u_int64_t ifi_udp_faithprefix; | |
277 | u_int64_t ifi_udp_port0; | |
278 | u_int64_t ifi_udp_badlength; | |
279 | u_int64_t ifi_udp_badchksum; | |
280 | u_int64_t ifi_udp_badmcast; | |
281 | u_int64_t ifi_udp_cleanup; | |
282 | u_int64_t ifi_udp_badipsec; | |
39236c6e | 283 | u_int64_t _reserved[4]; |
316670eb A |
284 | }; |
285 | ||
286 | struct if_description { | |
287 | u_int32_t ifd_maxlen; /* must be IF_DESCSIZE */ | |
288 | u_int32_t ifd_len; /* actual ifd_desc length */ | |
289 | u_int8_t *ifd_desc; /* ptr to desc buffer */ | |
290 | }; | |
291 | ||
292 | struct if_bandwidths { | |
293 | u_int64_t eff_bw; /* effective bandwidth */ | |
294 | u_int64_t max_bw; /* maximum theoretical bandwidth */ | |
295 | }; | |
296 | ||
39236c6e A |
297 | struct if_latencies { |
298 | u_int64_t eff_lt; /* effective latency */ | |
299 | u_int64_t max_lt; /* maximum theoretical latency */ | |
300 | }; | |
301 | ||
316670eb A |
302 | struct if_rxpoll_stats { |
303 | u_int32_t ifi_poll_off_req; /* total # of POLL_OFF reqs */ | |
304 | u_int32_t ifi_poll_off_err; /* total # of POLL_OFF errors */ | |
305 | u_int32_t ifi_poll_on_req; /* total # of POLL_ON reqs */ | |
306 | u_int32_t ifi_poll_on_err; /* total # of POLL_ON errors */ | |
307 | ||
308 | u_int32_t ifi_poll_wakeups_avg; /* avg # of wakeup reqs */ | |
309 | u_int32_t ifi_poll_wakeups_lowat; /* wakeups low watermark */ | |
310 | u_int32_t ifi_poll_wakeups_hiwat; /* wakeups high watermark */ | |
311 | ||
312 | u_int64_t ifi_poll_packets; /* total # of polled packets */ | |
313 | u_int32_t ifi_poll_packets_avg; /* average polled packets */ | |
314 | u_int32_t ifi_poll_packets_min; /* smallest polled packets */ | |
315 | u_int32_t ifi_poll_packets_max; /* largest polled packets */ | |
316 | u_int32_t ifi_poll_packets_lowat; /* packets low watermark */ | |
317 | u_int32_t ifi_poll_packets_hiwat; /* packets high watermark */ | |
318 | ||
319 | u_int64_t ifi_poll_bytes; /* total # of polled bytes */ | |
320 | u_int32_t ifi_poll_bytes_avg; /* average polled bytes */ | |
321 | u_int32_t ifi_poll_bytes_min; /* smallest polled bytes */ | |
322 | u_int32_t ifi_poll_bytes_max; /* largest polled bytes */ | |
323 | u_int32_t ifi_poll_bytes_lowat; /* bytes low watermark */ | |
324 | u_int32_t ifi_poll_bytes_hiwat; /* bytes high watermark */ | |
39236c6e A |
325 | |
326 | u_int32_t ifi_poll_packets_limit; /* max packets per poll call */ | |
327 | u_int64_t ifi_poll_interval_time; /* poll interval (nsec) */ | |
d41d1dae | 328 | }; |
6d2010ae A |
329 | #endif /* PRIVATE */ |
330 | ||
331 | #pragma pack() | |
d41d1dae | 332 | |
6d2010ae A |
333 | /* |
334 | * Structure defining a queue for a network interface. | |
335 | */ | |
336 | struct ifqueue { | |
337 | void *ifq_head; | |
338 | void *ifq_tail; | |
339 | int ifq_len; | |
340 | int ifq_maxlen; | |
341 | int ifq_drops; | |
342 | }; | |
343 | ||
316670eb | 344 | #ifdef BSD_KERNEL_PRIVATE |
91447636 A |
345 | /* |
346 | * Internal storage of if_data. This is bound to change. Various places in the | |
347 | * stack will translate this data structure in to the externally visible | |
6d2010ae A |
348 | * if_data structure above. Note that during interface attach time, the |
349 | * embedded if_data structure in ifnet is cleared, with the exception of | |
350 | * some non-statistics related fields. | |
91447636 A |
351 | */ |
352 | struct if_data_internal { | |
353 | /* generic interface information */ | |
2d21ac55 A |
354 | u_char ifi_type; /* ethernet, tokenring, etc */ |
355 | u_char ifi_typelen; /* Length of frame type id */ | |
356 | u_char ifi_physical; /* e.g., AUI, Thinnet, 10base-T, etc */ | |
357 | u_char ifi_addrlen; /* media address length */ | |
358 | u_char ifi_hdrlen; /* media header length */ | |
359 | u_char ifi_recvquota; /* polling quota for receive intrs */ | |
360 | u_char ifi_xmitquota; /* polling quota for xmit intrs */ | |
361 | u_char ifi_unused1; /* for future use */ | |
362 | u_int32_t ifi_mtu; /* maximum transmission unit */ | |
363 | u_int32_t ifi_metric; /* routing metric (external only) */ | |
364 | u_int32_t ifi_baudrate; /* linespeed */ | |
6d2010ae | 365 | u_int32_t _pad; |
1c79356b | 366 | /* volatile statistics */ |
91447636 A |
367 | u_int64_t ifi_ipackets; /* packets received on interface */ |
368 | u_int64_t ifi_ierrors; /* input errors on interface */ | |
369 | u_int64_t ifi_opackets; /* packets sent on interface */ | |
370 | u_int64_t ifi_oerrors; /* output errors on interface */ | |
371 | u_int64_t ifi_collisions; /* collisions on csma interfaces */ | |
2d21ac55 A |
372 | u_int64_t ifi_ibytes; /* total number of octets received */ |
373 | u_int64_t ifi_obytes; /* total number of octets sent */ | |
91447636 A |
374 | u_int64_t ifi_imcasts; /* packets received via multicast */ |
375 | u_int64_t ifi_omcasts; /* packets sent via multicast */ | |
376 | u_int64_t ifi_iqdrops; /* dropped on input, this interface */ | |
377 | u_int64_t ifi_noproto; /* destined for unsupported protocol */ | |
2d21ac55 A |
378 | u_int32_t ifi_recvtiming; /* usec spent receiving when timing */ |
379 | u_int32_t ifi_xmittiming; /* usec spent xmitting when timing */ | |
316670eb | 380 | u_int64_t ifi_alignerrs; /* unaligned (32-bit) input pkts */ |
39236c6e A |
381 | u_int64_t ifi_dt_bytes; /* Data threshold counter */ |
382 | u_int64_t ifi_fpackets; /* forwarded packets on interface */ | |
383 | u_int64_t ifi_fbytes; /* forwarded bytes on interface */ | |
1c79356b | 384 | struct timeval ifi_lastchange; /* time of last administrative change */ |
2d21ac55 | 385 | u_int32_t ifi_hwassist; /* HW offload capabilities */ |
b0d623f7 A |
386 | u_int32_t ifi_tso_v4_mtu; /* TCP Segment Offload IPv4 maximum segment size */ |
387 | u_int32_t ifi_tso_v6_mtu; /* TCP Segment Offload IPv6 maximum segment size */ | |
1c79356b | 388 | }; |
316670eb | 389 | |
39236c6e | 390 | #if MEASURE_BW |
316670eb A |
391 | /* |
392 | * Fields per interface to measure perceived bandwidth. | |
393 | */ | |
316670eb A |
394 | struct if_measured_bw { |
395 | u_int64_t bw; /* measured bandwidth in bytes per ms */ | |
396 | u_int64_t bytes; /* XXX not needed */ | |
397 | u_int64_t ts; /* XXX not needed */ | |
398 | u_int64_t cur_seq __attribute((aligned(8))); /* current sequence for marking a packet */ | |
399 | u_int64_t start_ts; /* time at which a measurement started */ | |
400 | u_int64_t start_seq; /* sequence at which a measurement should start */ | |
401 | u_int64_t last_seq; /* last recorded seq */ | |
402 | u_int64_t last_ts; /* last recorded ts */ | |
403 | u_int32_t flags __attribute__((aligned(4))); /* flags */ | |
404 | #define IF_MEASURED_BW_INPROGRESS 0x1 | |
405 | #define IF_MEASURED_BW_CALCULATION 0x2 | |
406 | }; | |
39236c6e | 407 | #endif /* MEASURE_BW */ |
316670eb | 408 | #endif /* BSD_KERNEL_PRIVATE */ |
91447636 | 409 | |
6d2010ae | 410 | #ifdef PRIVATE |
91447636 A |
411 | #define if_mtu if_data.ifi_mtu |
412 | #define if_type if_data.ifi_type | |
413 | #define if_typelen if_data.ifi_typelen | |
414 | #define if_physical if_data.ifi_physical | |
415 | #define if_addrlen if_data.ifi_addrlen | |
416 | #define if_hdrlen if_data.ifi_hdrlen | |
417 | #define if_metric if_data.ifi_metric | |
418 | #define if_baudrate if_data.ifi_baudrate | |
419 | #define if_hwassist if_data.ifi_hwassist | |
420 | #define if_ipackets if_data.ifi_ipackets | |
421 | #define if_ierrors if_data.ifi_ierrors | |
422 | #define if_opackets if_data.ifi_opackets | |
423 | #define if_oerrors if_data.ifi_oerrors | |
424 | #define if_collisions if_data.ifi_collisions | |
425 | #define if_ibytes if_data.ifi_ibytes | |
426 | #define if_obytes if_data.ifi_obytes | |
427 | #define if_imcasts if_data.ifi_imcasts | |
428 | #define if_omcasts if_data.ifi_omcasts | |
429 | #define if_iqdrops if_data.ifi_iqdrops | |
430 | #define if_noproto if_data.ifi_noproto | |
431 | #define if_lastchange if_data.ifi_lastchange | |
432 | #define if_recvquota if_data.ifi_recvquota | |
433 | #define if_xmitquota if_data.ifi_xmitquota | |
6d2010ae | 434 | #endif /* PRIVATE */ |
316670eb | 435 | #ifdef BSD_KERNEL_PRIVATE |
b0d623f7 A |
436 | #define if_tso_v4_mtu if_data.ifi_tso_v4_mtu |
437 | #define if_tso_v6_mtu if_data.ifi_tso_v6_mtu | |
316670eb | 438 | #define if_alignerrs if_data.ifi_alignerrs |
39236c6e A |
439 | #define if_dt_bytes if_data.ifi_dt_bytes |
440 | #define if_fpackets if_data.ifi_fpackets | |
441 | #define if_fbytes if_data.ifi_fbytes | |
316670eb | 442 | #endif /* BSD_KERNEL_PRIVATE */ |
91447636 | 443 | |
316670eb | 444 | #ifdef BSD_KERNEL_PRIVATE |
91447636 A |
445 | /* |
446 | * Forward structure declarations for function prototypes [sic]. | |
447 | */ | |
6d2010ae A |
448 | struct proc; |
449 | struct rtentry; | |
450 | struct socket; | |
91447636 | 451 | struct ifnet_filter; |
6d2010ae A |
452 | struct mbuf; |
453 | struct ifaddr; | |
454 | struct tqdummy; | |
455 | struct proto_hash_entry; | |
456 | struct dlil_threading_info; | |
316670eb A |
457 | struct tcpstat_local; |
458 | struct udpstat_local; | |
6d2010ae A |
459 | #if PF |
460 | struct pfi_kif; | |
461 | #endif /* PF */ | |
91447636 | 462 | |
6d2010ae A |
463 | /* we use TAILQs so that the order of instantiation is preserved in the list */ |
464 | TAILQ_HEAD(ifnethead, ifnet); | |
465 | TAILQ_HEAD(ifaddrhead, ifaddr); | |
466 | TAILQ_HEAD(ifprefixhead, ifprefix); | |
467 | LIST_HEAD(ifmultihead, ifmultiaddr); | |
468 | TAILQ_HEAD(tailq_head, tqdummy); | |
91447636 A |
469 | TAILQ_HEAD(ifnet_filter_head, ifnet_filter); |
470 | TAILQ_HEAD(ddesc_head_name, dlil_demux_desc); | |
316670eb | 471 | #endif /* BSD_KERNEL_PRIVATE */ |
91447636 | 472 | |
6d2010ae A |
473 | #ifdef PRIVATE |
474 | /* | |
475 | * All of the following IF_HWASSIST_* flags are defined in kpi_inteface.h as | |
476 | * IFNET_* flags. These are redefined here as constants to avoid failures to | |
477 | * build user level programs that can not include kpi_interface.h. It is | |
478 | * important to keep this in sync with the definitions in kpi_interface.h. | |
479 | * The corresponding constant for each definition is mentioned in the comment. | |
b0d623f7 | 480 | * |
6d2010ae | 481 | * Bottom 16 bits reserved for hardware checksum |
b0d623f7 A |
482 | */ |
483 | #define IF_HWASSIST_CSUM_IP 0x0001 /* will csum IP, IFNET_CSUM_IP */ | |
484 | #define IF_HWASSIST_CSUM_TCP 0x0002 /* will csum TCP, IFNET_CSUM_TCP */ | |
485 | #define IF_HWASSIST_CSUM_UDP 0x0004 /* will csum UDP, IFNET_CSUM_UDP */ | |
486 | #define IF_HWASSIST_CSUM_IP_FRAGS 0x0008 /* will csum IP fragments, IFNET_CSUM_FRAGMENT */ | |
487 | #define IF_HWASSIST_CSUM_FRAGMENT 0x0010 /* will do IP fragmentation, IFNET_IP_FRAGMENT */ | |
6d2010ae A |
488 | #define IF_HWASSIST_CSUM_TCPIPV6 0x0020 /* will csum TCPv6, IFNET_CSUM_TCPIPV6 */ |
489 | #define IF_HWASSIST_CSUM_UDPIPV6 0x0040 /* will csum UDPv6, IFNET_CSUM_UDP */ | |
490 | #define IF_HWASSIST_CSUM_FRAGMENT_IPV6 0x0080 /* will do IPv6 fragmentation, IFNET_IPV6_FRAGMENT */ | |
39236c6e | 491 | #define IF_HWASSIST_CSUM_PARTIAL 0x1000 /* simple Sum16 computation, IFNET_CSUM_PARTIAL */ |
91447636 A |
492 | #define IF_HWASSIST_CSUM_MASK 0xffff |
493 | #define IF_HWASSIST_CSUM_FLAGS(hwassist) ((hwassist) & IF_HWASSIST_CSUM_MASK) | |
494 | ||
495 | /* VLAN support */ | |
b0d623f7 A |
496 | #define IF_HWASSIST_VLAN_TAGGING 0x00010000 /* supports VLAN tagging, IFNET_VLAN_TAGGING */ |
497 | #define IF_HWASSIST_VLAN_MTU 0x00020000 /* supports VLAN MTU-sized packet (for software VLAN), IFNET_VLAN_MTU */ | |
498 | ||
499 | /* TCP Segment Offloading support */ | |
500 | ||
501 | #define IF_HWASSIST_TSO_V4 0x00200000 /* will do TCP Segment offload for IPv4, IFNET_TSO_IPV4 */ | |
502 | #define IF_HWASSIST_TSO_V6 0x00400000 /* will do TCP Segment offload for IPv6, IFNET_TSO_IPV6 */ | |
2d21ac55 | 503 | #endif /* PRIVATE */ |
1c79356b | 504 | |
39236c6e A |
505 | #ifdef PRIVATE |
506 | #define IFXNAMSIZ (IFNAMSIZ + 8) /* external name (name + unit) */ | |
507 | #endif | |
508 | ||
316670eb A |
509 | #ifdef BSD_KERNEL_PRIVATE |
510 | /* | |
511 | * ifnet is private to BSD portion of kernel | |
512 | */ | |
39236c6e | 513 | #include <sys/mcache.h> |
6d2010ae A |
514 | #include <sys/tree.h> |
515 | #include <netinet/in.h> | |
39236c6e | 516 | #include <net/if_dl.h> |
316670eb | 517 | #include <net/classq/if_classq.h> |
39236c6e | 518 | #include <net/if_types.h> |
2d21ac55 | 519 | |
6d2010ae | 520 | RB_HEAD(ll_reach_tree, if_llreach); /* define struct ll_reach_tree */ |
91447636 | 521 | |
39236c6e | 522 | #define if_name(ifp) ifp->if_xname |
1c79356b A |
523 | /* |
524 | * Structure defining a network interface. | |
525 | * | |
526 | * (Would like to call this struct ``if'', but C isn't PL/1.) | |
527 | */ | |
528 | struct ifnet { | |
6d2010ae A |
529 | /* |
530 | * Lock (RW or mutex) to protect this data structure (static storage.) | |
531 | */ | |
532 | decl_lck_rw_data(, if_lock); | |
533 | void *if_softc; /* pointer to driver state */ | |
534 | const char *if_name; /* name, e.g. ``en'' or ``lo'' */ | |
39236c6e | 535 | const char *if_xname; /* external name (name + unit) */ |
316670eb | 536 | struct if_description if_desc; /* extended description */ |
6d2010ae A |
537 | TAILQ_ENTRY(ifnet) if_link; /* all struct ifnets are chained */ |
538 | TAILQ_ENTRY(ifnet) if_detaching_link; /* list of detaching ifnets */ | |
539 | ||
540 | decl_lck_mtx_data(, if_ref_lock) | |
39236c6e | 541 | u_int32_t if_refflags; /* see IFRF flags below */ |
6d2010ae A |
542 | u_int32_t if_refio; /* number of io ops to the underlying driver */ |
543 | ||
544 | #define if_list if_link | |
545 | struct ifaddrhead if_addrhead; /* linked list of addresses per if */ | |
546 | #define if_addrlist if_addrhead | |
547 | struct ifaddr *if_lladdr; /* link address (first/permanent) */ | |
548 | ||
549 | int if_pcount; /* number of promiscuous listeners */ | |
550 | struct bpf_if *if_bpf; /* packet filter structure */ | |
551 | u_short if_index; /* numeric abbreviation for this if */ | |
552 | short if_unit; /* sub-unit for lower level driver */ | |
553 | short if_timer; /* time 'til if_watchdog called */ | |
554 | short if_flags; /* up/down, broadcast, etc. */ | |
555 | u_int32_t if_eflags; /* see <net/if.h> */ | |
556 | ||
557 | int if_capabilities; /* interface features & capabilities */ | |
558 | int if_capenable; /* enabled features & capabilities */ | |
559 | ||
560 | void *if_linkmib; /* link-type-specific MIB data */ | |
561 | size_t if_linkmiblen; /* length of above data */ | |
562 | ||
563 | struct if_data_internal if_data __attribute__((aligned(8))); | |
564 | ||
565 | ifnet_family_t if_family; /* value assigned by Apple */ | |
39236c6e | 566 | ifnet_subfamily_t if_subfamily; /* value assigned by Apple */ |
6d2010ae | 567 | uintptr_t if_family_cookie; |
91447636 | 568 | ifnet_output_func if_output; |
316670eb A |
569 | ifnet_pre_enqueue_func if_pre_enqueue; |
570 | ifnet_start_func if_start; | |
571 | ifnet_ctl_func if_output_ctl; | |
572 | ifnet_input_poll_func if_input_poll; | |
573 | ifnet_ctl_func if_input_ctl; | |
91447636 A |
574 | ifnet_ioctl_func if_ioctl; |
575 | ifnet_set_bpf_tap if_set_bpf_tap; | |
576 | ifnet_detached_func if_free; | |
577 | ifnet_demux_func if_demux; | |
578 | ifnet_event_func if_event; | |
39236c6e A |
579 | ifnet_framer_func if_framer_legacy; |
580 | ifnet_framer_extended_func if_framer; | |
6d2010ae A |
581 | ifnet_add_proto_func if_add_proto; |
582 | ifnet_del_proto_func if_del_proto; | |
583 | ifnet_check_multi if_check_multi; | |
584 | struct proto_hash_entry *if_proto_hash; | |
585 | void *if_kpi_storage; | |
1c79356b | 586 | |
39236c6e A |
587 | u_int32_t if_flowhash; /* interface flow control ID */ |
588 | ||
316670eb | 589 | decl_lck_mtx_data(, if_start_lock); |
39236c6e | 590 | u_int32_t if_start_flags; /* see IFSF flags below */ |
316670eb A |
591 | u_int32_t if_start_req; |
592 | u_int32_t if_start_active; /* output is active */ | |
593 | struct timespec if_start_cycle; /* restart interval */ | |
594 | struct thread *if_start_thread; | |
595 | ||
596 | struct ifclassq if_snd; /* transmit queue */ | |
597 | u_int32_t if_output_sched_model; /* tx sched model */ | |
598 | ||
599 | struct if_bandwidths if_output_bw; | |
600 | struct if_bandwidths if_input_bw; | |
601 | ||
39236c6e A |
602 | struct if_latencies if_output_lt; |
603 | struct if_latencies if_input_lt; | |
604 | ||
6d2010ae A |
605 | decl_lck_mtx_data(, if_flt_lock) |
606 | u_int32_t if_flt_busy; | |
607 | u_int32_t if_flt_waiters; | |
91447636 | 608 | struct ifnet_filter_head if_flt_head; |
1c79356b | 609 | |
6d2010ae A |
610 | struct ifmultihead if_multiaddrs; /* multicast addresses */ |
611 | u_int32_t if_updatemcasts; /* mcast addrs need updating */ | |
612 | int if_amcount; /* # of all-multicast reqs */ | |
613 | decl_lck_mtx_data(, if_addrconfig_lock); /* for serializing addr config */ | |
614 | struct in_multi *if_allhostsinm; /* store all-hosts inm for this ifp */ | |
1c79356b | 615 | |
316670eb A |
616 | decl_lck_mtx_data(, if_poll_lock); |
617 | u_int16_t if_poll_req; | |
618 | u_int16_t if_poll_update; /* link update */ | |
619 | u_int32_t if_poll_active; /* polling is active */ | |
620 | struct timespec if_poll_cycle; /* poll interval */ | |
621 | struct thread *if_poll_thread; | |
91447636 | 622 | |
316670eb | 623 | struct dlil_threading_info *if_inp; |
91447636 | 624 | |
6d2010ae | 625 | struct ifprefixhead if_prefixhead; /* list of prefixes per if */ |
91447636 | 626 | struct { |
b0d623f7 | 627 | u_int32_t length; |
91447636 A |
628 | union { |
629 | u_char buffer[8]; | |
630 | u_char *ptr; | |
631 | } u; | |
632 | } if_broadcast; | |
2d21ac55 | 633 | #if CONFIG_MACF_NET |
6d2010ae | 634 | struct label *if_label; /* interface MAC label */ |
2d21ac55 | 635 | #endif |
b0d623f7 | 636 | |
6d2010ae | 637 | u_int32_t if_wake_properties; |
b0d623f7 | 638 | #if PF |
6d2010ae | 639 | struct pfi_kif *if_pf_kif; |
b0d623f7 | 640 | #endif /* PF */ |
1c79356b | 641 | |
6d2010ae A |
642 | decl_lck_mtx_data(, if_cached_route_lock); |
643 | u_int32_t if_fwd_cacheok; | |
644 | struct route if_fwd_route; /* cached forwarding route */ | |
645 | struct route if_src_route; /* cached ipv4 source route */ | |
646 | struct route_in6 if_src_route6; /* cached ipv6 source route */ | |
91447636 | 647 | |
6d2010ae A |
648 | decl_lck_rw_data(, if_llreach_lock); |
649 | struct ll_reach_tree if_ll_srcs; /* source link-layer tree */ | |
91447636 | 650 | |
6d2010ae A |
651 | void *if_bridge; /* bridge glue */ |
652 | ||
653 | u_int32_t if_want_aggressive_drain; | |
654 | u_int32_t if_idle_flags; /* idle flags */ | |
655 | u_int32_t if_idle_new_flags; /* temporary idle flags */ | |
656 | u_int32_t if_idle_new_flags_mask; /* temporary mask */ | |
657 | u_int32_t if_route_refcnt; /* idle: route ref count */ | |
658 | ||
659 | struct if_traffic_class if_tc __attribute__((aligned(8))); | |
660 | #if INET | |
661 | struct igmp_ifinfo *if_igi; /* for IGMPv3 */ | |
662 | #endif /* INET */ | |
663 | #if INET6 | |
664 | struct mld_ifinfo *if_mli; /* for MLDv2 */ | |
665 | #endif /* INET6 */ | |
316670eb A |
666 | |
667 | int if_lqm; /* link quality metric */ | |
39236c6e | 668 | #if MEASURE_BW |
316670eb | 669 | struct if_measured_bw if_bw; |
39236c6e | 670 | #endif /* MEASURE_BW */ |
316670eb A |
671 | struct tcpstat_local *if_tcp_stat; /* TCP specific stats */ |
672 | struct udpstat_local *if_udp_stat; /* UDP specific stats */ | |
39236c6e A |
673 | |
674 | struct { | |
675 | int32_t level; /* cached logging level */ | |
676 | u_int32_t flags; /* cached logging flags */ | |
677 | int32_t category; /* cached category */ | |
678 | int32_t subcategory; /* cached subcategory */ | |
679 | } if_log; | |
680 | ||
681 | struct { | |
682 | struct ifnet *ifp; /* delegated ifp */ | |
683 | u_int32_t type; /* delegated i/f type */ | |
684 | u_int32_t family; /* delegated i/f family */ | |
685 | u_int32_t subfamily; /* delegated i/f sub-family */ | |
fe8ab488 | 686 | uint32_t expensive:1; /* delegated i/f expensive? */ |
39236c6e A |
687 | } if_delegated; |
688 | ||
689 | u_int64_t if_data_threshold; | |
690 | u_int32_t if_fg_sendts; /* last send on a fg socket in seconds */ | |
691 | ||
692 | #if INET6 | |
693 | decl_lck_rw_data(, if_inet6data_lock); | |
694 | void *if_inet6data; | |
695 | #endif | |
6d2010ae A |
696 | }; |
697 | ||
39236c6e A |
698 | #define IF_TCP_STATINC(_ifp, _s) do { \ |
699 | if ((_ifp)->if_tcp_stat != NULL) \ | |
700 | atomic_add_64(&(_ifp)->if_tcp_stat->_s, 1); \ | |
701 | } while (0); | |
702 | ||
703 | #define IF_UDP_STATINC(_ifp, _s) do { \ | |
704 | if ((_ifp)->if_udp_stat != NULL) \ | |
705 | atomic_add_64(&(_ifp)->if_udp_stat->_s, 1); \ | |
706 | } while (0); | |
707 | ||
6d2010ae | 708 | /* |
39236c6e | 709 | * Valid values for if_refflags |
6d2010ae A |
710 | */ |
711 | #define IFRF_ATTACHED 0x1 /* ifnet attach is completely done */ | |
712 | #define IFRF_DETACHING 0x2 /* detach has been requested */ | |
91447636 | 713 | |
39236c6e A |
714 | /* |
715 | * Valid values for if_start_flags | |
716 | */ | |
717 | #define IFSF_FLOW_CONTROLLED 0x1 /* flow controlled */ | |
718 | ||
4a249263 A |
719 | /* |
720 | * Structure describing a `cloning' interface. | |
721 | */ | |
722 | struct if_clone { | |
723 | LIST_ENTRY(if_clone) ifc_list; /* on list of cloners */ | |
6d2010ae A |
724 | const char *ifc_name; /* name of device, e.g. `vlan' */ |
725 | size_t ifc_namelen; /* length of name */ | |
726 | u_int32_t ifc_minifs; /* minimum number of interfaces */ | |
727 | u_int32_t ifc_maxunit; /* maximum unit number */ | |
728 | unsigned char *ifc_units; /* bitmap to handle units */ | |
729 | u_int32_t ifc_bmlen; /* bitmap length */ | |
730 | ||
731 | int (*ifc_create)(struct if_clone *, u_int32_t, void *); | |
732 | int (*ifc_destroy)(struct ifnet *); | |
4a249263 A |
733 | }; |
734 | ||
6d2010ae A |
735 | #define IF_CLONE_INITIALIZER(name, create, destroy, minifs, maxunit) { \ |
736 | { NULL, NULL }, name, (sizeof (name) - 1), minifs, maxunit, NULL, 0, \ | |
737 | create, destroy \ | |
738 | } | |
9bccf70c | 739 | |
d1ecb069 A |
740 | #define M_CLONE M_IFADDR |
741 | ||
1c79356b | 742 | /* |
6d2010ae A |
743 | * Macros to manipulate ifqueue. Users of these macros are responsible |
744 | * for serialization, by holding whatever lock is appropriate for the | |
745 | * corresponding structure that is referring the ifqueue. | |
1c79356b A |
746 | */ |
747 | #define IF_QFULL(ifq) ((ifq)->ifq_len >= (ifq)->ifq_maxlen) | |
748 | #define IF_DROP(ifq) ((ifq)->ifq_drops++) | |
316670eb A |
749 | |
750 | #define IF_ENQUEUE(ifq, m) do { \ | |
6d2010ae A |
751 | (m)->m_nextpkt = NULL; \ |
752 | if ((ifq)->ifq_tail == NULL) \ | |
753 | (ifq)->ifq_head = m; \ | |
754 | else \ | |
755 | ((struct mbuf*)(ifq)->ifq_tail)->m_nextpkt = m; \ | |
756 | (ifq)->ifq_tail = m; \ | |
757 | (ifq)->ifq_len++; \ | |
316670eb A |
758 | } while (0) |
759 | ||
760 | #define IF_PREPEND(ifq, m) do { \ | |
6d2010ae A |
761 | (m)->m_nextpkt = (ifq)->ifq_head; \ |
762 | if ((ifq)->ifq_tail == NULL) \ | |
763 | (ifq)->ifq_tail = (m); \ | |
764 | (ifq)->ifq_head = (m); \ | |
765 | (ifq)->ifq_len++; \ | |
316670eb A |
766 | } while (0) |
767 | ||
768 | #define IF_DEQUEUE(ifq, m) do { \ | |
6d2010ae A |
769 | (m) = (ifq)->ifq_head; \ |
770 | if (m != NULL) { \ | |
771 | if (((ifq)->ifq_head = (m)->m_nextpkt) == NULL) \ | |
772 | (ifq)->ifq_tail = NULL; \ | |
773 | (m)->m_nextpkt = NULL; \ | |
774 | (ifq)->ifq_len--; \ | |
775 | } \ | |
316670eb A |
776 | } while (0) |
777 | ||
778 | #define IF_REMQUEUE(ifq, m) do { \ | |
6d2010ae A |
779 | struct mbuf *_p = (ifq)->ifq_head; \ |
780 | struct mbuf *_n = (m)->m_nextpkt; \ | |
781 | if ((m) == _p) \ | |
782 | _p = NULL; \ | |
783 | while (_p != NULL) { \ | |
784 | if (_p->m_nextpkt == (m)) \ | |
785 | break; \ | |
786 | _p = _p->m_nextpkt; \ | |
787 | } \ | |
788 | VERIFY(_p != NULL || ((m) == (ifq)->ifq_head)); \ | |
789 | if ((m) == (ifq)->ifq_head) \ | |
790 | (ifq)->ifq_head = _n; \ | |
791 | if ((m) == (ifq)->ifq_tail) \ | |
792 | (ifq)->ifq_tail = _p; \ | |
793 | VERIFY((ifq)->ifq_tail != NULL || (ifq)->ifq_head == NULL); \ | |
794 | VERIFY((ifq)->ifq_len != 0); \ | |
795 | --(ifq)->ifq_len; \ | |
796 | if (_p != NULL) \ | |
797 | _p->m_nextpkt = _n; \ | |
798 | (m)->m_nextpkt = NULL; \ | |
316670eb A |
799 | } while (0) |
800 | ||
6d2010ae | 801 | #define IF_DRAIN(ifq) do { \ |
316670eb | 802 | struct mbuf *_m; \ |
6d2010ae | 803 | for (;;) { \ |
316670eb A |
804 | IF_DEQUEUE(ifq, _m); \ |
805 | if (_m == NULL) \ | |
6d2010ae | 806 | break; \ |
316670eb | 807 | m_freem(_m); \ |
6d2010ae A |
808 | } \ |
809 | } while (0) | |
1c79356b | 810 | |
1c79356b A |
811 | /* |
812 | * The ifaddr structure contains information about one address | |
813 | * of an interface. They are maintained by the different address families, | |
814 | * are allocated and attached when an address is set, and are linked | |
815 | * together so all addresses for an interface can be located. | |
816 | */ | |
817 | struct ifaddr { | |
6d2010ae A |
818 | decl_lck_mtx_data(, ifa_lock); /* lock for ifaddr */ |
819 | uint32_t ifa_refcnt; /* ref count, use IFA_{ADD,REM}REF */ | |
820 | uint32_t ifa_debug; /* debug flags */ | |
821 | struct sockaddr *ifa_addr; /* address of interface */ | |
822 | struct sockaddr *ifa_dstaddr; /* other end of p-to-p link */ | |
1c79356b | 823 | #define ifa_broadaddr ifa_dstaddr /* broadcast address interface */ |
6d2010ae A |
824 | struct sockaddr *ifa_netmask; /* used to determine subnet */ |
825 | struct ifnet *ifa_ifp; /* back-pointer to interface */ | |
1c79356b | 826 | TAILQ_ENTRY(ifaddr) ifa_link; /* queue macro glue */ |
b0d623f7 A |
827 | void (*ifa_rtrequest) /* check or clean routes (+ or -)'d */ |
828 | (int, struct rtentry *, struct sockaddr *); | |
6d2010ae A |
829 | uint32_t ifa_flags; /* mostly rt_flags for cloning */ |
830 | int32_t ifa_metric; /* cost of going out this interface */ | |
b0d623f7 A |
831 | void (*ifa_free)(struct ifaddr *); /* callback fn for freeing */ |
832 | void (*ifa_trace) /* callback fn for tracing refs */ | |
833 | (struct ifaddr *, int); | |
6d2010ae A |
834 | void (*ifa_attached)(struct ifaddr *); /* callback fn for attaching */ |
835 | void (*ifa_detached)(struct ifaddr *); /* callback fn for detaching */ | |
1c79356b | 836 | }; |
b0d623f7 A |
837 | |
838 | /* | |
839 | * Valid values for ifa_flags | |
840 | */ | |
91447636 A |
841 | #define IFA_ROUTE RTF_UP /* route installed (0x1) */ |
842 | #define IFA_CLONING RTF_CLONING /* (0x100) */ | |
b0d623f7 A |
843 | |
844 | /* | |
845 | * Valid values for ifa_debug | |
846 | */ | |
6d2010ae | 847 | #define IFD_ATTACHED 0x1 /* attached to list */ |
b0d623f7 A |
848 | #define IFD_ALLOC 0x2 /* dynamically allocated */ |
849 | #define IFD_DEBUG 0x4 /* has debugging info */ | |
6d2010ae A |
850 | #define IFD_LINK 0x8 /* link address */ |
851 | #define IFD_TRASHED 0x10 /* in trash list */ | |
852 | #define IFD_SKIP 0x20 /* skip this entry */ | |
853 | #define IFD_NOTREADY 0x40 /* embryonic; not yet ready */ | |
91447636 | 854 | |
6d2010ae A |
855 | #define IFA_LOCK_ASSERT_HELD(_ifa) \ |
856 | lck_mtx_assert(&(_ifa)->ifa_lock, LCK_MTX_ASSERT_OWNED) | |
857 | ||
858 | #define IFA_LOCK_ASSERT_NOTHELD(_ifa) \ | |
859 | lck_mtx_assert(&(_ifa)->ifa_lock, LCK_MTX_ASSERT_NOTOWNED) | |
860 | ||
861 | #define IFA_LOCK(_ifa) \ | |
862 | lck_mtx_lock(&(_ifa)->ifa_lock) | |
863 | ||
864 | #define IFA_LOCK_SPIN(_ifa) \ | |
865 | lck_mtx_lock_spin(&(_ifa)->ifa_lock) | |
866 | ||
867 | #define IFA_CONVERT_LOCK(_ifa) do { \ | |
868 | IFA_LOCK_ASSERT_HELD(_ifa); \ | |
869 | lck_mtx_convert_spin(&(_ifa)->ifa_lock); \ | |
870 | } while (0) | |
871 | ||
872 | #define IFA_UNLOCK(_ifa) \ | |
873 | lck_mtx_unlock(&(_ifa)->ifa_lock) | |
874 | ||
875 | #define IFA_ADDREF(_ifa) \ | |
876 | ifa_addref(_ifa, 0) | |
877 | ||
878 | #define IFA_ADDREF_LOCKED(_ifa) \ | |
879 | ifa_addref(_ifa, 1) | |
880 | ||
881 | #define IFA_REMREF(_ifa) do { \ | |
882 | (void) ifa_remref(_ifa, 0); \ | |
883 | } while (0) | |
884 | ||
885 | #define IFA_REMREF_LOCKED(_ifa) \ | |
886 | ifa_remref(_ifa, 1) | |
1c79356b A |
887 | |
888 | /* | |
889 | * The prefix structure contains information about one prefix | |
890 | * of an interface. They are maintained by the different address families, | |
891 | * are allocated and attached when an prefix or an address is set, | |
892 | * and are linked together so all prefixes for an interface can be located. | |
893 | */ | |
894 | struct ifprefix { | |
895 | struct sockaddr *ifpr_prefix; /* prefix of interface */ | |
896 | struct ifnet *ifpr_ifp; /* back-pointer to interface */ | |
9bccf70c | 897 | TAILQ_ENTRY(ifprefix) ifpr_list; /* queue macro glue */ |
1c79356b A |
898 | u_char ifpr_plen; /* prefix length in bits */ |
899 | u_char ifpr_type; /* protocol dependent prefix type */ | |
900 | }; | |
901 | ||
902 | /* | |
903 | * Multicast address structure. This is analogous to the ifaddr | |
904 | * structure except that it keeps track of multicast addresses. | |
6d2010ae A |
905 | * Also, the request count here is a count of requests for this |
906 | * address, not a count of pointers to this structure; anonymous | |
907 | * membership(s) holds one outstanding request count. | |
1c79356b A |
908 | */ |
909 | struct ifmultiaddr { | |
6d2010ae A |
910 | decl_lck_mtx_data(, ifma_lock); |
911 | u_int32_t ifma_refcount; /* reference count */ | |
912 | u_int32_t ifma_anoncnt; /* # of anonymous requests */ | |
913 | u_int32_t ifma_reqcnt; /* total requests for this address */ | |
914 | u_int32_t ifma_debug; /* see ifa_debug flags */ | |
915 | u_int32_t ifma_flags; /* see below */ | |
1c79356b | 916 | LIST_ENTRY(ifmultiaddr) ifma_link; /* queue macro glue */ |
6d2010ae | 917 | struct sockaddr *ifma_addr; /* address this membership is for */ |
91447636 | 918 | struct ifmultiaddr *ifma_ll; /* link-layer translation, if any */ |
6d2010ae A |
919 | struct ifnet *ifma_ifp; /* back-pointer to interface */ |
920 | void *ifma_protospec; /* protocol-specific state, if any */ | |
921 | void (*ifma_trace) /* callback fn for tracing refs */ | |
922 | (struct ifmultiaddr *, int); | |
1c79356b | 923 | }; |
1c79356b | 924 | |
91447636 | 925 | /* |
6d2010ae | 926 | * Values for ifma_flags |
91447636 | 927 | */ |
6d2010ae A |
928 | #define IFMAF_ANONYMOUS 0x1 /* has anonymous request ref(s) held */ |
929 | ||
930 | #define IFMA_LOCK_ASSERT_HELD(_ifma) \ | |
931 | lck_mtx_assert(&(_ifma)->ifma_lock, LCK_MTX_ASSERT_OWNED) | |
932 | ||
933 | #define IFMA_LOCK_ASSERT_NOTHELD(_ifma) \ | |
934 | lck_mtx_assert(&(_ifma)->ifma_lock, LCK_MTX_ASSERT_NOTOWNED) | |
935 | ||
936 | #define IFMA_LOCK(_ifma) \ | |
937 | lck_mtx_lock(&(_ifma)->ifma_lock) | |
938 | ||
939 | #define IFMA_LOCK_SPIN(_ifma) \ | |
940 | lck_mtx_lock_spin(&(_ifma)->ifma_lock) | |
941 | ||
942 | #define IFMA_CONVERT_LOCK(_ifma) do { \ | |
943 | IFMA_LOCK_ASSERT_HELD(_ifma); \ | |
944 | lck_mtx_convert_spin(&(_ifma)->ifma_lock); \ | |
945 | } while (0) | |
946 | ||
947 | #define IFMA_UNLOCK(_ifma) \ | |
948 | lck_mtx_unlock(&(_ifma)->ifma_lock) | |
949 | ||
950 | #define IFMA_ADDREF(_ifma) \ | |
951 | ifma_addref(_ifma, 0) | |
952 | ||
953 | #define IFMA_ADDREF_LOCKED(_ifma) \ | |
954 | ifma_addref(_ifma, 1) | |
955 | ||
956 | #define IFMA_REMREF(_ifma) \ | |
957 | ifma_remref(_ifma) | |
958 | ||
39236c6e A |
959 | /* |
960 | * Indicate whether or not the immediate interface, or the interface delegated | |
961 | * by it, is a cellular interface (IFT_CELLULAR). Delegated interface type is | |
962 | * set/cleared along with the delegated ifp; we cache the type for performance | |
963 | * to avoid dereferencing delegated ifp each time. | |
964 | * | |
965 | * Note that this is meant to be used only for accounting and policy purposes; | |
966 | * certain places need to explicitly know the immediate interface type, and | |
967 | * this macro should not be used there. | |
968 | * | |
969 | * The test is done against IFT_CELLULAR instead of IFNET_FAMILY_CELLULAR to | |
970 | * handle certain cases where the family isn't set to the latter. | |
971 | */ | |
972 | #define IFNET_IS_CELLULAR(_ifp) \ | |
973 | ((_ifp)->if_type == IFT_CELLULAR || \ | |
974 | (_ifp)->if_delegated.type == IFT_CELLULAR) | |
975 | ||
976 | /* | |
977 | * Indicate whether or not the immediate interface, or the interface delegated | |
978 | * by it, is a Wi-Fi interface (IFNET_SUBFAMILY_WIFI). Delegated interface | |
979 | * subfamily is set/cleared along with the delegated ifp; we cache the subfamily | |
980 | * for performance to avoid dereferencing delegated ifp each time. | |
981 | * | |
982 | * Note that this is meant to be used only for accounting and policy purposes; | |
983 | * certain places need to explicitly know the immediate interface type, and | |
984 | * this macro should not be used there. | |
985 | * | |
986 | * The test is done against IFNET_SUBFAMILY_WIFI as the family may be set to | |
987 | * IFNET_FAMILY_ETHERNET (as well as type to IFT_ETHER) which is too generic. | |
988 | */ | |
989 | #define IFNET_IS_WIFI(_ifp) \ | |
990 | ((_ifp)->if_subfamily == IFNET_SUBFAMILY_WIFI || \ | |
991 | (_ifp)->if_delegated.subfamily == IFNET_SUBFAMILY_WIFI) | |
992 | ||
fe8ab488 A |
993 | /* |
994 | * Indicate whether or not the immediate interface, or the interface delegated | |
995 | * by it, is a Wired interface (several families). Delegated interface | |
996 | * family is set/cleared along with the delegated ifp; we cache the family | |
997 | * for performance to avoid dereferencing delegated ifp each time. | |
998 | * | |
999 | * Note that this is meant to be used only for accounting and policy purposes; | |
1000 | * certain places need to explicitly know the immediate interface type, and | |
1001 | * this macro should not be used there. | |
1002 | */ | |
1003 | #define IFNET_IS_WIRED(_ifp) \ | |
1004 | ((_ifp)->if_family == IFNET_FAMILY_ETHERNET || \ | |
1005 | (_ifp)->if_delegated.family == IFNET_FAMILY_ETHERNET || \ | |
1006 | (_ifp)->if_family == IFNET_FAMILY_FIREWIRE || \ | |
1007 | (_ifp)->if_delegated.family == IFNET_FAMILY_FIREWIRE) | |
1008 | ||
1009 | /* | |
1010 | * Indicate whether or not the immediate interface, or the interface delegated | |
1011 | * by it, is marked as expensive. The delegated interface is set/cleared | |
1012 | * along with the delegated ifp; we cache the flag for performance to avoid | |
1013 | * dereferencing delegated ifp each time. | |
1014 | * | |
1015 | * Note that this is meant to be used only for policy purposes. | |
1016 | */ | |
1017 | #define IFNET_IS_EXPENSIVE(_ifp) \ | |
1018 | ((_ifp)->if_eflags & IFEF_EXPENSIVE || \ | |
1019 | (_ifp)->if_delegated.expensive) | |
1020 | ||
1021 | /* | |
1022 | * We don't support AWDL interface delegation. | |
1023 | */ | |
1024 | #define IFNET_IS_AWDL_RESTRICTED(_ifp) \ | |
1025 | (((_ifp)->if_eflags & (IFEF_AWDL|IFEF_AWDL_RESTRICTED)) == \ | |
1026 | (IFEF_AWDL|IFEF_AWDL_RESTRICTED)) | |
1027 | ||
1028 | ||
39236c6e A |
1029 | extern struct ifnethead ifnet_head; |
1030 | extern struct ifnet **ifindex2ifnet; | |
1031 | extern u_int32_t if_sndq_maxlen; | |
1032 | extern u_int32_t if_rcvq_maxlen; | |
1033 | extern int if_index; | |
1034 | extern struct ifaddr **ifnet_addrs; | |
1035 | extern lck_attr_t *ifa_mtx_attr; | |
1036 | extern lck_grp_t *ifa_mtx_grp; | |
1037 | extern lck_grp_t *ifnet_lock_group; | |
1038 | extern lck_attr_t *ifnet_lock_attr; | |
6d2010ae | 1039 | extern ifnet_t lo_ifp; |
316670eb A |
1040 | extern uint32_t if_bw_measure_size; |
1041 | extern u_int32_t if_bw_smoothing_val; | |
6d2010ae A |
1042 | |
1043 | extern int if_addmulti(struct ifnet *, const struct sockaddr *, | |
1044 | struct ifmultiaddr **); | |
1045 | extern int if_addmulti_anon(struct ifnet *, const struct sockaddr *, | |
1046 | struct ifmultiaddr **); | |
1047 | extern int if_allmulti(struct ifnet *, int); | |
1048 | extern int if_delmulti(struct ifnet *, const struct sockaddr *); | |
1049 | extern int if_delmulti_ifma(struct ifmultiaddr *); | |
1050 | extern int if_delmulti_anon(struct ifnet *, const struct sockaddr *); | |
1051 | extern void if_down(struct ifnet *); | |
1052 | extern int if_down_all(void); | |
1053 | extern void if_up(struct ifnet *); | |
1054 | __private_extern__ void if_updown(struct ifnet *ifp, int up); | |
1055 | extern int ifioctl(struct socket *, u_long, caddr_t, struct proc *); | |
1056 | extern int ifioctllocked(struct socket *, u_long, caddr_t, struct proc *); | |
1057 | extern struct ifnet *ifunit(const char *); | |
1058 | extern struct ifnet *if_withname(struct sockaddr *); | |
316670eb A |
1059 | extern void if_qflush(struct ifnet *, int); |
1060 | extern void if_qflush_sc(struct ifnet *, mbuf_svc_class_t, u_int32_t, | |
1061 | u_int32_t *, u_int32_t *, int); | |
6d2010ae A |
1062 | |
1063 | extern struct if_clone *if_clone_lookup(const char *, u_int32_t *); | |
1064 | extern int if_clone_attach(struct if_clone *); | |
1065 | extern void if_clone_detach(struct if_clone *); | |
1066 | ||
1067 | extern errno_t if_mcasts_update(struct ifnet *); | |
1068 | ||
1069 | typedef enum { | |
1070 | IFNET_LCK_ASSERT_EXCLUSIVE, /* RW: held as writer */ | |
1071 | IFNET_LCK_ASSERT_SHARED, /* RW: held as reader */ | |
1072 | IFNET_LCK_ASSERT_OWNED, /* RW: writer/reader, MTX: held */ | |
1073 | IFNET_LCK_ASSERT_NOTOWNED /* not held */ | |
1074 | } ifnet_lock_assert_t; | |
1075 | ||
39236c6e A |
1076 | #define IF_LLADDR(_ifp) \ |
1077 | (LLADDR(SDL(((_ifp)->if_lladdr)->ifa_addr))) | |
1078 | ||
6d2010ae A |
1079 | __private_extern__ void ifnet_lock_assert(struct ifnet *, ifnet_lock_assert_t); |
1080 | __private_extern__ void ifnet_lock_shared(struct ifnet *ifp); | |
1081 | __private_extern__ void ifnet_lock_exclusive(struct ifnet *ifp); | |
1082 | __private_extern__ void ifnet_lock_done(struct ifnet *ifp); | |
1083 | ||
39236c6e A |
1084 | #if INET6 |
1085 | __private_extern__ void if_inet6data_lock_shared(struct ifnet *ifp); | |
1086 | __private_extern__ void if_inet6data_lock_exclusive(struct ifnet *ifp); | |
1087 | __private_extern__ void if_inet6data_lock_done(struct ifnet *ifp); | |
1088 | #endif | |
1089 | ||
6d2010ae A |
1090 | __private_extern__ void ifnet_head_lock_shared(void); |
1091 | __private_extern__ void ifnet_head_lock_exclusive(void); | |
1092 | __private_extern__ void ifnet_head_done(void); | |
1093 | ||
1094 | __private_extern__ errno_t ifnet_set_idle_flags_locked(ifnet_t, u_int32_t, | |
1095 | u_int32_t); | |
1096 | __private_extern__ int ifnet_is_attached(struct ifnet *, int refio); | |
1097 | __private_extern__ void ifnet_decr_iorefcnt(struct ifnet *); | |
316670eb A |
1098 | __private_extern__ void ifnet_set_start_cycle(struct ifnet *, |
1099 | struct timespec *); | |
1100 | __private_extern__ void ifnet_set_poll_cycle(struct ifnet *, | |
1101 | struct timespec *); | |
6d2010ae A |
1102 | |
1103 | __private_extern__ void if_attach_ifa(struct ifnet *, struct ifaddr *); | |
1104 | __private_extern__ void if_attach_link_ifa(struct ifnet *, struct ifaddr *); | |
1105 | __private_extern__ void if_detach_ifa(struct ifnet *, struct ifaddr *); | |
1106 | __private_extern__ void if_detach_link_ifa(struct ifnet *, struct ifaddr *); | |
1107 | ||
7ddcb079 A |
1108 | __private_extern__ void dlil_if_lock(void); |
1109 | __private_extern__ void dlil_if_unlock(void); | |
1110 | __private_extern__ void dlil_if_lock_assert(void); | |
1111 | ||
6d2010ae | 1112 | extern struct ifaddr *ifa_ifwithaddr(const struct sockaddr *); |
316670eb A |
1113 | extern struct ifaddr *ifa_ifwithaddr_scoped(const struct sockaddr *, |
1114 | unsigned int); | |
6d2010ae A |
1115 | extern struct ifaddr *ifa_ifwithdstaddr(const struct sockaddr *); |
1116 | extern struct ifaddr *ifa_ifwithnet(const struct sockaddr *); | |
316670eb A |
1117 | extern struct ifaddr *ifa_ifwithnet_scoped(const struct sockaddr *, |
1118 | unsigned int); | |
6d2010ae A |
1119 | extern struct ifaddr *ifa_ifwithroute(int, const struct sockaddr *, |
1120 | const struct sockaddr *); | |
316670eb A |
1121 | extern struct ifaddr *ifa_ifwithroute_locked(int, const struct sockaddr *, |
1122 | const struct sockaddr *); | |
1123 | extern struct ifaddr *ifa_ifwithroute_scoped_locked(int, | |
1124 | const struct sockaddr *, const struct sockaddr *, unsigned int); | |
6d2010ae A |
1125 | extern struct ifaddr *ifaof_ifpforaddr(const struct sockaddr *, struct ifnet *); |
1126 | __private_extern__ struct ifaddr *ifa_ifpgetprimary(struct ifnet *, int); | |
1127 | extern void ifa_addref(struct ifaddr *, int); | |
1128 | extern struct ifaddr *ifa_remref(struct ifaddr *, int); | |
1129 | extern void ifa_lock_init(struct ifaddr *); | |
1130 | extern void ifa_lock_destroy(struct ifaddr *); | |
1131 | extern void ifma_addref(struct ifmultiaddr *, int); | |
1132 | extern void ifma_remref(struct ifmultiaddr *); | |
1133 | ||
1134 | extern void ifa_init(void); | |
1135 | ||
1136 | __private_extern__ struct in_ifaddr *ifa_foraddr(unsigned int); | |
1137 | __private_extern__ struct in_ifaddr *ifa_foraddr_scoped(unsigned int, | |
1138 | unsigned int); | |
1139 | ||
316670eb A |
1140 | struct ifreq; |
1141 | extern errno_t ifnet_getset_opportunistic(struct ifnet *, u_long, | |
1142 | struct ifreq *, struct proc *); | |
1143 | extern int ifnet_get_throttle(struct ifnet *, u_int32_t *); | |
1144 | extern int ifnet_set_throttle(struct ifnet *, u_int32_t); | |
39236c6e A |
1145 | extern errno_t ifnet_getset_log(struct ifnet *, u_long, |
1146 | struct ifreq *, struct proc *); | |
1147 | extern int ifnet_set_log(struct ifnet *, int32_t, uint32_t, int32_t, int32_t); | |
1148 | extern int ifnet_get_log(struct ifnet *, int32_t *, uint32_t *, int32_t *, | |
1149 | int32_t *); | |
1150 | extern int ifnet_notify_address(struct ifnet *, int); | |
316670eb | 1151 | |
6d2010ae A |
1152 | #if INET6 |
1153 | struct in6_addr; | |
1154 | __private_extern__ struct in6_ifaddr *ifa_foraddr6(struct in6_addr *); | |
1155 | __private_extern__ struct in6_ifaddr *ifa_foraddr6_scoped(struct in6_addr *, | |
1156 | unsigned int); | |
1157 | #endif /* INET6 */ | |
1158 | ||
1159 | __private_extern__ void if_data_internal_to_if_data(struct ifnet *ifp, | |
1160 | const struct if_data_internal *if_data_int, struct if_data *if_data); | |
1161 | __private_extern__ void if_data_internal_to_if_data64(struct ifnet *ifp, | |
1162 | const struct if_data_internal *if_data_int, struct if_data64 *if_data64); | |
1163 | __private_extern__ void if_copy_traffic_class(struct ifnet *ifp, | |
1164 | struct if_traffic_class *if_tc); | |
316670eb A |
1165 | __private_extern__ void if_copy_data_extended(struct ifnet *ifp, |
1166 | struct if_data_extended *if_de); | |
1167 | __private_extern__ void if_copy_packet_stats(struct ifnet *ifp, | |
1168 | struct if_packet_stats *if_ps); | |
1169 | __private_extern__ void if_copy_rxpoll_stats(struct ifnet *ifp, | |
1170 | struct if_rxpoll_stats *if_rs); | |
6d2010ae A |
1171 | |
1172 | __private_extern__ struct rtentry *ifnet_cached_rtlookup_inet(struct ifnet *, | |
1173 | struct in_addr); | |
1174 | #if INET6 | |
1175 | __private_extern__ struct rtentry *ifnet_cached_rtlookup_inet6(struct ifnet *, | |
1176 | struct in6_addr *); | |
1177 | #endif /* INET6 */ | |
1178 | ||
316670eb A |
1179 | __private_extern__ void if_lqm_update(struct ifnet *, int32_t); |
1180 | __private_extern__ void ifnet_update_sndq(struct ifclassq *, cqev_t); | |
1181 | __private_extern__ void ifnet_update_rcv(struct ifnet *, cqev_t); | |
1182 | ||
39236c6e A |
1183 | __private_extern__ void ifnet_flowadv(uint32_t); |
1184 | ||
316670eb A |
1185 | __private_extern__ errno_t ifnet_set_input_bandwidths(struct ifnet *, |
1186 | struct if_bandwidths *); | |
1187 | __private_extern__ errno_t ifnet_set_output_bandwidths(struct ifnet *, | |
1188 | struct if_bandwidths *, boolean_t); | |
1189 | __private_extern__ u_int64_t ifnet_output_linkrate(struct ifnet *); | |
1190 | __private_extern__ u_int64_t ifnet_input_linkrate(struct ifnet *); | |
39236c6e A |
1191 | |
1192 | __private_extern__ errno_t ifnet_set_input_latencies(struct ifnet *, | |
1193 | struct if_latencies *); | |
1194 | __private_extern__ errno_t ifnet_set_output_latencies(struct ifnet *, | |
1195 | struct if_latencies *, boolean_t); | |
1196 | ||
1197 | __private_extern__ errno_t ifnet_framer_stub(struct ifnet *, struct mbuf **, | |
1198 | const struct sockaddr *, const char *, const char *, u_int32_t *, | |
1199 | u_int32_t *); | |
316670eb A |
1200 | #endif /* BSD_KERNEL_PRIVATE */ |
1201 | #ifdef XNU_KERNEL_PRIVATE | |
1202 | /* for uuid.c */ | |
1203 | __private_extern__ int uuid_get_ethernet(u_int8_t *); | |
6d2010ae | 1204 | #endif /* XNU_KERNEL_PRIVATE */ |
1c79356b | 1205 | #endif /* !_NET_IF_VAR_H_ */ |