ifq.h revision 193731
1139823Simp/*- 221259Swollman * Copyright (c) 1982, 1986, 1989, 1993 321259Swollman * The Regents of the University of California. All rights reserved. 421259Swollman * 521259Swollman * Redistribution and use in source and binary forms, with or without 621259Swollman * modification, are permitted provided that the following conditions 721259Swollman * are met: 821259Swollman * 1. Redistributions of source code must retain the above copyright 921259Swollman * notice, this list of conditions and the following disclaimer. 1021259Swollman * 2. Redistributions in binary form must reproduce the above copyright 1121259Swollman * notice, this list of conditions and the following disclaimer in the 1221259Swollman * documentation and/or other materials provided with the distribution. 1321259Swollman * 4. Neither the name of the University nor the names of its contributors 1421259Swollman * may be used to endorse or promote products derived from this software 1521259Swollman * without specific prior written permission. 1621259Swollman * 1721259Swollman * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 1821259Swollman * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1921259Swollman * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2021259Swollman * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2121259Swollman * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2221259Swollman * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2321259Swollman * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2421259Swollman * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2521259Swollman * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2621259Swollman * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2721259Swollman * SUCH DAMAGE. 2821259Swollman * 2921259Swollman * From: @(#)if.h 8.1 (Berkeley) 6/10/93 3050477Speter * $FreeBSD: head/sys/net/if_var.h 193731 2009-06-08 17:15:40Z zec $ 3121259Swollman */ 3221259Swollman 3321259Swollman#ifndef _NET_IF_VAR_H_ 3421259Swollman#define _NET_IF_VAR_H_ 3521259Swollman 3621259Swollman/* 3721259Swollman * Structures defining a network interface, providing a packet 3821259Swollman * transport mechanism (ala level 0 of the PUP protocols). 3921259Swollman * 4021259Swollman * Each interface accepts output datagrams of a specified maximum 4121259Swollman * length, and provides higher level routines with input datagrams 4221259Swollman * received from its medium. 4321259Swollman * 4421259Swollman * Output occurs when the routine if_output is called, with three parameters: 4521259Swollman * (*ifp->if_output)(ifp, m, dst, rt) 4621259Swollman * Here m is the mbuf chain to be sent and dst is the destination address. 4721259Swollman * The output routine encapsulates the supplied datagram if necessary, 4821259Swollman * and then transmits it on its medium. 4921259Swollman * 5021259Swollman * On input, each interface unwraps the data received by it, and either 51108533Sschweikh * places it on the input queue of an internetwork datagram routine 5221259Swollman * and posts the associated software interrupt, or passes the datagram to a raw 5321259Swollman * packet input routine. 5421259Swollman * 5521259Swollman * Routines exist for locating interfaces by their addresses 56108533Sschweikh * or for locating an interface on a certain network, as well as more general 5721259Swollman * routing and gateway routines maintaining information used to locate 5821259Swollman * interfaces. These routines live in the files if.c and route.c 5921259Swollman */ 6021259Swollman 6121259Swollman#ifdef __STDC__ 6221259Swollman/* 6321259Swollman * Forward structure declarations for function prototypes [sic]. 6421259Swollman */ 6521259Swollmanstruct mbuf; 6683366Sjulianstruct thread; 6721259Swollmanstruct rtentry; 6885074Srustruct rt_addrinfo; 6921259Swollmanstruct socket; 7021259Swollmanstruct ether_header; 71142215Sglebiusstruct carp_if; 72155051Sglebiusstruct ifvlantrunk; 73191148Skmacystruct route; 74193731Szecstruct vnet; 7521259Swollman#endif 7621259Swollman 7721259Swollman#include <sys/queue.h> /* get TAILQ macros */ 7821259Swollman 7969224Sjlemon#ifdef _KERNEL 8069152Sjlemon#include <sys/mbuf.h> 81126264Smlaier#include <sys/eventhandler.h> 82186207Skmacy#include <sys/buf_ring.h> 8369224Sjlemon#endif /* _KERNEL */ 8474914Sjhb#include <sys/lock.h> /* XXX */ 8574914Sjhb#include <sys/mutex.h> /* XXX */ 86186199Skmacy#include <sys/rwlock.h> /* XXX */ 8783130Sjlemon#include <sys/event.h> /* XXX */ 88132712Srwatson#include <sys/_task.h> 8969152Sjlemon 90121816Sbrooks#define IF_DUNIT_NONE -1 91121816Sbrooks 92130416Smlaier#include <altq/if_altq.h> 93130416Smlaier 9460938SjakeTAILQ_HEAD(ifnethead, ifnet); /* we use TAILQs so that the order of */ 9560938SjakeTAILQ_HEAD(ifaddrhead, ifaddr); /* instantiation is preserved in the list */ 9660938SjakeTAILQ_HEAD(ifprefixhead, ifprefix); 9772084SphkTAILQ_HEAD(ifmultihead, ifmultiaddr); 98159781SmlaierTAILQ_HEAD(ifgrouphead, ifg_group); 9921259Swollman 10021259Swollman/* 10121259Swollman * Structure defining a queue for a network interface. 10221259Swollman */ 10321259Swollmanstruct ifqueue { 10421259Swollman struct mbuf *ifq_head; 10521259Swollman struct mbuf *ifq_tail; 10621259Swollman int ifq_len; 10721259Swollman int ifq_maxlen; 10821259Swollman int ifq_drops; 10969152Sjlemon struct mtx ifq_mtx; 11021259Swollman}; 11121259Swollman 11221259Swollman/* 11321259Swollman * Structure defining a network interface. 11421259Swollman * 11521259Swollman * (Would like to call this struct ``if'', but C isn't PL/1.) 11621259Swollman */ 11784380Smjacob 11821259Swollmanstruct ifnet { 11921259Swollman void *if_softc; /* pointer to driver state */ 120147256Sbrooks void *if_l2com; /* pointer to protocol bits */ 121191688Szec struct vnet *if_vnet; /* pointer to network stack instance */ 12260938Sjake TAILQ_ENTRY(ifnet) if_link; /* all struct ifnets are chained */ 123121816Sbrooks char if_xname[IFNAMSIZ]; /* external name (name + unit) */ 124121816Sbrooks const char *if_dname; /* driver name */ 125121816Sbrooks int if_dunit; /* unit or IF_DUNIT_NONE */ 126191367Srwatson u_int if_refcount; /* reference count */ 12721259Swollman struct ifaddrhead if_addrhead; /* linked list of addresses per if */ 128128291Sluigi /* 129128291Sluigi * if_addrhead is the list of all addresses associated to 130128315Sluigi * an interface. 131128315Sluigi * Some code in the kernel assumes that first element 132128315Sluigi * of the list has type AF_LINK, and contains sockaddr_dl 133128315Sluigi * addresses which store the link-level address and the name 134128291Sluigi * of the interface. 135128315Sluigi * However, access to the AF_LINK address through this 136152315Sru * field is deprecated. Use if_addr or ifaddr_byindex() instead. 137128291Sluigi */ 138133741Sjmg struct knlist if_klist; /* events attached to this if */ 13983130Sjlemon int if_pcount; /* number of promiscuous listeners */ 140142901Sglebius struct carp_if *if_carp; /* carp interface structure */ 14121259Swollman struct bpf_if *if_bpf; /* packet filter structure */ 14221259Swollman u_short if_index; /* numeric abbreviation for this if */ 14321259Swollman short if_timer; /* time 'til if_watchdog called */ 144155051Sglebius struct ifvlantrunk *if_vlantrunk; /* pointer to 802.1q data */ 145102052Ssobomax int if_flags; /* up/down, broadcast, etc. */ 146162070Sandre int if_capabilities; /* interface features & capabilities */ 147162070Sandre int if_capenable; /* enabled features & capabilities */ 14821259Swollman void *if_linkmib; /* link-type-specific MIB data */ 14921259Swollman size_t if_linkmiblen; /* length of above data */ 15021259Swollman struct if_data if_data; 15121404Swollman struct ifmultihead if_multiaddrs; /* multicast addresses configured */ 15221404Swollman int if_amcount; /* number of all-multicast requests */ 15321259Swollman/* procedure handles */ 15421259Swollman int (*if_output) /* output routine (enqueue) */ 15592725Salfred (struct ifnet *, struct mbuf *, struct sockaddr *, 156191148Skmacy struct route *); 157106931Ssam void (*if_input) /* input routine (from h/w driver) */ 158106931Ssam (struct ifnet *, struct mbuf *); 15921259Swollman void (*if_start) /* initiate output routine */ 16092725Salfred (struct ifnet *); 16121259Swollman int (*if_ioctl) /* ioctl routine */ 16292725Salfred (struct ifnet *, u_long, caddr_t); 16321259Swollman void (*if_watchdog) /* timer routine */ 16492725Salfred (struct ifnet *); 16521259Swollman void (*if_init) /* Init routine */ 16692725Salfred (void *); 16721404Swollman int (*if_resolvemulti) /* validate/resolve multicast */ 16892725Salfred (struct ifnet *, struct sockaddr **, struct sockaddr *); 169189230Srwatson void (*if_qflush) /* flush any queues */ 170189230Srwatson (struct ifnet *); 171189230Srwatson int (*if_transmit) /* initiate output routine */ 172189230Srwatson (struct ifnet *, struct mbuf *); 173193731Szec void (*if_reassign) /* reassign to vnet routine */ 174193731Szec (struct ifnet *, struct vnet *, char *); 175193731Szec struct vnet *if_home_vnet; /* where this ifnet originates from */ 176152315Sru struct ifaddr *if_addr; /* pointer to link-level address */ 177174388Skmacy void *if_llsoftc; /* link layer softc */ 178148265Srwatson int if_drv_flags; /* driver-managed status flags */ 179130416Smlaier struct ifaltq if_snd; /* output queue (includes altq) */ 180123220Simp const u_int8_t *if_broadcastaddr; /* linklevel broadcast bytestring */ 181127828Sluigi 182146986Sthompsa void *if_bridge; /* bridge glue */ 183146986Sthompsa 184122524Srwatson struct label *if_label; /* interface MAC label */ 185121161Sume 186127828Sluigi /* these are only used by IPv6 */ 187127828Sluigi struct ifprefixhead if_prefixhead; /* list of prefixes per if */ 188121161Sume void *if_afdata[AF_MAX]; 189121470Sume int if_afdata_initialized; 190186199Skmacy struct rwlock if_afdata_lock; 191145320Sglebius struct task if_linktask; /* task for link change events */ 192148640Srwatson struct mtx if_addr_mtx; /* mutex to protect address lists */ 193186119Sqingli 194152209Sthompsa LIST_ENTRY(ifnet) if_clones; /* interfaces of a cloner */ 195159781Smlaier TAILQ_HEAD(, ifg_list) if_groups; /* linked list of groups per if */ 196159781Smlaier /* protected by if_addr_mtx */ 197159781Smlaier void *if_pf_kif; 198168793Sthompsa void *if_lagg; /* lagg glue */ 199191367Srwatson u_char if_alloctype; /* if_type at time of allocation */ 200189230Srwatson 201189230Srwatson /* 202189230Srwatson * Spare fields are added so that we can modify sensitive data 203189230Srwatson * structures without changing the kernel binary interface, and must 204189230Srwatson * be used with care where binary compatibility is required. 205189230Srwatson */ 206191367Srwatson char if_cspare[3]; 207189230Srwatson void *if_pspare[8]; 208189230Srwatson int if_ispare[4]; 20921259Swollman}; 21069152Sjlemon 21192725Salfredtypedef void if_init_f_t(void *); 21221259Swollman 213128376Sluigi/* 214128376Sluigi * XXX These aliases are terribly dangerous because they could apply 215128376Sluigi * to anything. 216128376Sluigi */ 21721259Swollman#define if_mtu if_data.ifi_mtu 21821259Swollman#define if_type if_data.ifi_type 21921259Swollman#define if_physical if_data.ifi_physical 22021259Swollman#define if_addrlen if_data.ifi_addrlen 22121259Swollman#define if_hdrlen if_data.ifi_hdrlen 22221259Swollman#define if_metric if_data.ifi_metric 223128871Sandre#define if_link_state if_data.ifi_link_state 22421259Swollman#define if_baudrate if_data.ifi_baudrate 22558698Sjlemon#define if_hwassist if_data.ifi_hwassist 22621259Swollman#define if_ipackets if_data.ifi_ipackets 22721259Swollman#define if_ierrors if_data.ifi_ierrors 22821259Swollman#define if_opackets if_data.ifi_opackets 22921259Swollman#define if_oerrors if_data.ifi_oerrors 23021259Swollman#define if_collisions if_data.ifi_collisions 23121259Swollman#define if_ibytes if_data.ifi_ibytes 23221259Swollman#define if_obytes if_data.ifi_obytes 23321259Swollman#define if_imcasts if_data.ifi_imcasts 23421259Swollman#define if_omcasts if_data.ifi_omcasts 23521259Swollman#define if_iqdrops if_data.ifi_iqdrops 23621259Swollman#define if_noproto if_data.ifi_noproto 23721259Swollman#define if_lastchange if_data.ifi_lastchange 238136950Sjmg#define if_rawoutput(if, m, sa) if_output(if, m, sa, (struct rtentry *)NULL) 23921259Swollman 24053541Sshin/* for compatibility with other BSDs */ 24153541Sshin#define if_addrlist if_addrhead 24253541Sshin#define if_list if_link 243160981Sbrooks#define if_name(ifp) ((ifp)->if_xname) 24453541Sshin 24521259Swollman/* 246148640Srwatson * Locks for address lists on the network interface. 247148640Srwatson */ 248148640Srwatson#define IF_ADDR_LOCK_INIT(if) mtx_init(&(if)->if_addr_mtx, \ 249148640Srwatson "if_addr_mtx", NULL, MTX_DEF) 250148640Srwatson#define IF_ADDR_LOCK_DESTROY(if) mtx_destroy(&(if)->if_addr_mtx) 251148640Srwatson#define IF_ADDR_LOCK(if) mtx_lock(&(if)->if_addr_mtx) 252148640Srwatson#define IF_ADDR_UNLOCK(if) mtx_unlock(&(if)->if_addr_mtx) 253148640Srwatson#define IF_ADDR_LOCK_ASSERT(if) mtx_assert(&(if)->if_addr_mtx, MA_OWNED) 254148640Srwatson 255148640Srwatson/* 25621259Swollman * Output queues (ifp->if_snd) and slow device input queues (*ifp->if_slowq) 25721259Swollman * are queues of messages stored on ifqueue structures 25821259Swollman * (defined above). Entries are added to and deleted from these structures 25921259Swollman * by these macros, which should be called with ipl raised to splimp(). 26021259Swollman */ 26172200Sbmilekic#define IF_LOCK(ifq) mtx_lock(&(ifq)->ifq_mtx) 26272200Sbmilekic#define IF_UNLOCK(ifq) mtx_unlock(&(ifq)->ifq_mtx) 263130416Smlaier#define IF_LOCK_ASSERT(ifq) mtx_assert(&(ifq)->ifq_mtx, MA_OWNED) 26469152Sjlemon#define _IF_QFULL(ifq) ((ifq)->ifq_len >= (ifq)->ifq_maxlen) 26569152Sjlemon#define _IF_DROP(ifq) ((ifq)->ifq_drops++) 26669152Sjlemon#define _IF_QLEN(ifq) ((ifq)->ifq_len) 26721259Swollman 26869152Sjlemon#define _IF_ENQUEUE(ifq, m) do { \ 26969152Sjlemon (m)->m_nextpkt = NULL; \ 27069152Sjlemon if ((ifq)->ifq_tail == NULL) \ 27169152Sjlemon (ifq)->ifq_head = m; \ 27269152Sjlemon else \ 27369152Sjlemon (ifq)->ifq_tail->m_nextpkt = m; \ 27469152Sjlemon (ifq)->ifq_tail = m; \ 27569152Sjlemon (ifq)->ifq_len++; \ 27669152Sjlemon} while (0) 27769152Sjlemon 27869152Sjlemon#define IF_ENQUEUE(ifq, m) do { \ 27969152Sjlemon IF_LOCK(ifq); \ 28069152Sjlemon _IF_ENQUEUE(ifq, m); \ 28169152Sjlemon IF_UNLOCK(ifq); \ 28269152Sjlemon} while (0) 28369152Sjlemon 28469152Sjlemon#define _IF_PREPEND(ifq, m) do { \ 28569152Sjlemon (m)->m_nextpkt = (ifq)->ifq_head; \ 28669152Sjlemon if ((ifq)->ifq_tail == NULL) \ 28769152Sjlemon (ifq)->ifq_tail = (m); \ 28869152Sjlemon (ifq)->ifq_head = (m); \ 28969152Sjlemon (ifq)->ifq_len++; \ 29069152Sjlemon} while (0) 29169152Sjlemon 29269152Sjlemon#define IF_PREPEND(ifq, m) do { \ 29369152Sjlemon IF_LOCK(ifq); \ 29469152Sjlemon _IF_PREPEND(ifq, m); \ 29569152Sjlemon IF_UNLOCK(ifq); \ 29669152Sjlemon} while (0) 29769152Sjlemon 29869152Sjlemon#define _IF_DEQUEUE(ifq, m) do { \ 29969152Sjlemon (m) = (ifq)->ifq_head; \ 30069152Sjlemon if (m) { \ 301136950Sjmg if (((ifq)->ifq_head = (m)->m_nextpkt) == NULL) \ 30269152Sjlemon (ifq)->ifq_tail = NULL; \ 30369152Sjlemon (m)->m_nextpkt = NULL; \ 30469152Sjlemon (ifq)->ifq_len--; \ 30569152Sjlemon } \ 30669152Sjlemon} while (0) 30769152Sjlemon 30869152Sjlemon#define IF_DEQUEUE(ifq, m) do { \ 30969152Sjlemon IF_LOCK(ifq); \ 31069152Sjlemon _IF_DEQUEUE(ifq, m); \ 31169152Sjlemon IF_UNLOCK(ifq); \ 31269152Sjlemon} while (0) 31369152Sjlemon 314130416Smlaier#define _IF_POLL(ifq, m) ((m) = (ifq)->ifq_head) 315130416Smlaier#define IF_POLL(ifq, m) _IF_POLL(ifq, m) 316130416Smlaier 317130416Smlaier#define _IF_DRAIN(ifq) do { \ 31869152Sjlemon struct mbuf *m; \ 31969152Sjlemon for (;;) { \ 32069152Sjlemon _IF_DEQUEUE(ifq, m); \ 32169152Sjlemon if (m == NULL) \ 32269152Sjlemon break; \ 32369152Sjlemon m_freem(m); \ 32469152Sjlemon } \ 32569152Sjlemon} while (0) 32669152Sjlemon 327130416Smlaier#define IF_DRAIN(ifq) do { \ 328130416Smlaier IF_LOCK(ifq); \ 329130416Smlaier _IF_DRAIN(ifq); \ 330130416Smlaier IF_UNLOCK(ifq); \ 331130416Smlaier} while(0) 332130416Smlaier 33355205Speter#ifdef _KERNEL 334126264Smlaier/* interface address change event */ 335126264Smlaiertypedef void (*ifaddr_event_handler_t)(void *, struct ifnet *); 336126264SmlaierEVENTHANDLER_DECLARE(ifaddr_event, ifaddr_event_handler_t); 337126264Smlaier/* new interface arrival event */ 338126264Smlaiertypedef void (*ifnet_arrival_event_handler_t)(void *, struct ifnet *); 339126264SmlaierEVENTHANDLER_DECLARE(ifnet_arrival_event, ifnet_arrival_event_handler_t); 340126264Smlaier/* interface departure event */ 341126264Smlaiertypedef void (*ifnet_departure_event_handler_t)(void *, struct ifnet *); 342126264SmlaierEVENTHANDLER_DECLARE(ifnet_departure_event, ifnet_departure_event_handler_t); 343126264Smlaier 344159781Smlaier/* 345159781Smlaier * interface groups 346159781Smlaier */ 347159781Smlaierstruct ifg_group { 348159781Smlaier char ifg_group[IFNAMSIZ]; 349159781Smlaier u_int ifg_refcnt; 350159781Smlaier void *ifg_pf_kif; 351159781Smlaier TAILQ_HEAD(, ifg_member) ifg_members; 352159781Smlaier TAILQ_ENTRY(ifg_group) ifg_next; 353159781Smlaier}; 354159781Smlaier 355159781Smlaierstruct ifg_member { 356159781Smlaier TAILQ_ENTRY(ifg_member) ifgm_next; 357159781Smlaier struct ifnet *ifgm_ifp; 358159781Smlaier}; 359159781Smlaier 360159781Smlaierstruct ifg_list { 361159781Smlaier struct ifg_group *ifgl_group; 362159781Smlaier TAILQ_ENTRY(ifg_list) ifgl_next; 363159781Smlaier}; 364159781Smlaier 365159781Smlaier/* group attach event */ 366159781Smlaiertypedef void (*group_attach_event_handler_t)(void *, struct ifg_group *); 367159781SmlaierEVENTHANDLER_DECLARE(group_attach_event, group_attach_event_handler_t); 368159781Smlaier/* group detach event */ 369159781Smlaiertypedef void (*group_detach_event_handler_t)(void *, struct ifg_group *); 370159781SmlaierEVENTHANDLER_DECLARE(group_detach_event, group_detach_event_handler_t); 371159781Smlaier/* group change event */ 372159781Smlaiertypedef void (*group_change_event_handler_t)(void *, const char *); 373159781SmlaierEVENTHANDLER_DECLARE(group_change_event, group_change_event_handler_t); 374159781Smlaier 375121470Sume#define IF_AFDATA_LOCK_INIT(ifp) \ 376186199Skmacy rw_init(&(ifp)->if_afdata_lock, "if_afdata") 377121470Sume 378186199Skmacy#define IF_AFDATA_WLOCK(ifp) rw_wlock(&(ifp)->if_afdata_lock) 379186199Skmacy#define IF_AFDATA_RLOCK(ifp) rw_rlock(&(ifp)->if_afdata_lock) 380186199Skmacy#define IF_AFDATA_WUNLOCK(ifp) rw_wunlock(&(ifp)->if_afdata_lock) 381186199Skmacy#define IF_AFDATA_RUNLOCK(ifp) rw_runlock(&(ifp)->if_afdata_lock) 382186199Skmacy#define IF_AFDATA_LOCK(ifp) IF_AFDATA_WLOCK(ifp) 383186199Skmacy#define IF_AFDATA_UNLOCK(ifp) IF_AFDATA_WUNLOCK(ifp) 384186199Skmacy#define IF_AFDATA_TRYLOCK(ifp) rw_try_wlock(&(ifp)->if_afdata_lock) 385186199Skmacy#define IF_AFDATA_DESTROY(ifp) rw_destroy(&(ifp)->if_afdata_lock) 386186119Sqingli 387186199Skmacy#define IF_AFDATA_LOCK_ASSERT(ifp) rw_assert(&(ifp)->if_afdata_lock, RA_LOCKED) 388186199Skmacy#define IF_AFDATA_UNLOCK_ASSERT(ifp) rw_assert(&(ifp)->if_afdata_lock, RA_UNLOCKED) 389186199Skmacy 390137065Srwatsonint if_handoff(struct ifqueue *ifq, struct mbuf *m, struct ifnet *ifp, 391137065Srwatson int adjust); 392130416Smlaier#define IF_HANDOFF(ifq, m, ifp) \ 393130416Smlaier if_handoff((struct ifqueue *)ifq, m, ifp, 0) 394130416Smlaier#define IF_HANDOFF_ADJ(ifq, m, ifp, adj) \ 395130416Smlaier if_handoff((struct ifqueue *)ifq, m, ifp, adj) 39621259Swollman 397132712Srwatsonvoid if_start(struct ifnet *); 398132712Srwatson 399130416Smlaier#define IFQ_ENQUEUE(ifq, m, err) \ 400130416Smlaierdo { \ 401130416Smlaier IF_LOCK(ifq); \ 402130416Smlaier if (ALTQ_IS_ENABLED(ifq)) \ 403130416Smlaier ALTQ_ENQUEUE(ifq, m, NULL, err); \ 404130416Smlaier else { \ 405130416Smlaier if (_IF_QFULL(ifq)) { \ 406130416Smlaier m_freem(m); \ 407130416Smlaier (err) = ENOBUFS; \ 408130416Smlaier } else { \ 409130416Smlaier _IF_ENQUEUE(ifq, m); \ 410130416Smlaier (err) = 0; \ 411130416Smlaier } \ 412130416Smlaier } \ 413130416Smlaier if (err) \ 414130416Smlaier (ifq)->ifq_drops++; \ 415130416Smlaier IF_UNLOCK(ifq); \ 416130416Smlaier} while (0) 41721259Swollman 418130416Smlaier#define IFQ_DEQUEUE_NOLOCK(ifq, m) \ 419130416Smlaierdo { \ 420130416Smlaier if (TBR_IS_ENABLED(ifq)) \ 421130508Smlaier (m) = tbr_dequeue_ptr(ifq, ALTDQ_REMOVE); \ 422130416Smlaier else if (ALTQ_IS_ENABLED(ifq)) \ 423130416Smlaier ALTQ_DEQUEUE(ifq, m); \ 424130416Smlaier else \ 425130416Smlaier _IF_DEQUEUE(ifq, m); \ 426130416Smlaier} while (0) 427130416Smlaier 428130416Smlaier#define IFQ_DEQUEUE(ifq, m) \ 429130416Smlaierdo { \ 430130416Smlaier IF_LOCK(ifq); \ 431130416Smlaier IFQ_DEQUEUE_NOLOCK(ifq, m); \ 432130416Smlaier IF_UNLOCK(ifq); \ 433130416Smlaier} while (0) 434130416Smlaier 435130416Smlaier#define IFQ_POLL_NOLOCK(ifq, m) \ 436130416Smlaierdo { \ 437130416Smlaier if (TBR_IS_ENABLED(ifq)) \ 438130508Smlaier (m) = tbr_dequeue_ptr(ifq, ALTDQ_POLL); \ 439130416Smlaier else if (ALTQ_IS_ENABLED(ifq)) \ 440130416Smlaier ALTQ_POLL(ifq, m); \ 441130416Smlaier else \ 442130416Smlaier _IF_POLL(ifq, m); \ 443130416Smlaier} while (0) 444130416Smlaier 445130416Smlaier#define IFQ_POLL(ifq, m) \ 446130416Smlaierdo { \ 447130416Smlaier IF_LOCK(ifq); \ 448130416Smlaier IFQ_POLL_NOLOCK(ifq, m); \ 449130416Smlaier IF_UNLOCK(ifq); \ 450130416Smlaier} while (0) 451130416Smlaier 452130416Smlaier#define IFQ_PURGE_NOLOCK(ifq) \ 453130416Smlaierdo { \ 454130416Smlaier if (ALTQ_IS_ENABLED(ifq)) { \ 455130416Smlaier ALTQ_PURGE(ifq); \ 456130416Smlaier } else \ 457130416Smlaier _IF_DRAIN(ifq); \ 458130416Smlaier} while (0) 459130416Smlaier 460130416Smlaier#define IFQ_PURGE(ifq) \ 461130416Smlaierdo { \ 462130416Smlaier IF_LOCK(ifq); \ 463130416Smlaier IFQ_PURGE_NOLOCK(ifq); \ 464130416Smlaier IF_UNLOCK(ifq); \ 465130416Smlaier} while (0) 466130416Smlaier 467130416Smlaier#define IFQ_SET_READY(ifq) \ 468130416Smlaier do { ((ifq)->altq_flags |= ALTQF_READY); } while (0) 469130416Smlaier 470130416Smlaier#define IFQ_LOCK(ifq) IF_LOCK(ifq) 471130416Smlaier#define IFQ_UNLOCK(ifq) IF_UNLOCK(ifq) 472130416Smlaier#define IFQ_LOCK_ASSERT(ifq) IF_LOCK_ASSERT(ifq) 473130416Smlaier#define IFQ_IS_EMPTY(ifq) ((ifq)->ifq_len == 0) 474130416Smlaier#define IFQ_INC_LEN(ifq) ((ifq)->ifq_len++) 475130416Smlaier#define IFQ_DEC_LEN(ifq) (--(ifq)->ifq_len) 476130416Smlaier#define IFQ_INC_DROPS(ifq) ((ifq)->ifq_drops++) 477130416Smlaier#define IFQ_SET_MAXLEN(ifq, len) ((ifq)->ifq_maxlen = (len)) 478130416Smlaier 479148886Srwatson/* 480148886Srwatson * The IFF_DRV_OACTIVE test should really occur in the device driver, not in 481148886Srwatson * the handoff logic, as that flag is locked by the device driver. 482148886Srwatson */ 483130416Smlaier#define IFQ_HANDOFF_ADJ(ifp, m, adj, err) \ 484130416Smlaierdo { \ 485130416Smlaier int len; \ 486130416Smlaier short mflags; \ 487130416Smlaier \ 488130416Smlaier len = (m)->m_pkthdr.len; \ 489130416Smlaier mflags = (m)->m_flags; \ 490130416Smlaier IFQ_ENQUEUE(&(ifp)->if_snd, m, err); \ 491130416Smlaier if ((err) == 0) { \ 492130416Smlaier (ifp)->if_obytes += len + (adj); \ 493130416Smlaier if (mflags & M_MCAST) \ 494130416Smlaier (ifp)->if_omcasts++; \ 495148886Srwatson if (((ifp)->if_drv_flags & IFF_DRV_OACTIVE) == 0) \ 496132712Srwatson if_start(ifp); \ 497130416Smlaier } \ 498130416Smlaier} while (0) 499130416Smlaier 500130416Smlaier#define IFQ_HANDOFF(ifp, m, err) \ 501130512Smlaier IFQ_HANDOFF_ADJ(ifp, m, 0, err) 502130416Smlaier 503130416Smlaier#define IFQ_DRV_DEQUEUE(ifq, m) \ 504130416Smlaierdo { \ 505130416Smlaier (m) = (ifq)->ifq_drv_head; \ 506130416Smlaier if (m) { \ 507130416Smlaier if (((ifq)->ifq_drv_head = (m)->m_nextpkt) == NULL) \ 508130416Smlaier (ifq)->ifq_drv_tail = NULL; \ 509130416Smlaier (m)->m_nextpkt = NULL; \ 510130416Smlaier (ifq)->ifq_drv_len--; \ 511130416Smlaier } else { \ 512130416Smlaier IFQ_LOCK(ifq); \ 513130416Smlaier IFQ_DEQUEUE_NOLOCK(ifq, m); \ 514130416Smlaier while ((ifq)->ifq_drv_len < (ifq)->ifq_drv_maxlen) { \ 515130416Smlaier struct mbuf *m0; \ 516130416Smlaier IFQ_DEQUEUE_NOLOCK(ifq, m0); \ 517130416Smlaier if (m0 == NULL) \ 518130416Smlaier break; \ 519130416Smlaier m0->m_nextpkt = NULL; \ 520130416Smlaier if ((ifq)->ifq_drv_tail == NULL) \ 521130416Smlaier (ifq)->ifq_drv_head = m0; \ 522130416Smlaier else \ 523130416Smlaier (ifq)->ifq_drv_tail->m_nextpkt = m0; \ 524130416Smlaier (ifq)->ifq_drv_tail = m0; \ 525130416Smlaier (ifq)->ifq_drv_len++; \ 526130416Smlaier } \ 527130416Smlaier IFQ_UNLOCK(ifq); \ 528130416Smlaier } \ 529130416Smlaier} while (0) 530130416Smlaier 531130416Smlaier#define IFQ_DRV_PREPEND(ifq, m) \ 532130416Smlaierdo { \ 533130416Smlaier (m)->m_nextpkt = (ifq)->ifq_drv_head; \ 534132152Smlaier if ((ifq)->ifq_drv_tail == NULL) \ 535132152Smlaier (ifq)->ifq_drv_tail = (m); \ 536130416Smlaier (ifq)->ifq_drv_head = (m); \ 537130416Smlaier (ifq)->ifq_drv_len++; \ 538130416Smlaier} while (0) 539130416Smlaier 540130416Smlaier#define IFQ_DRV_IS_EMPTY(ifq) \ 541130416Smlaier (((ifq)->ifq_drv_len == 0) && ((ifq)->ifq_len == 0)) 542130416Smlaier 543130416Smlaier#define IFQ_DRV_PURGE(ifq) \ 544130416Smlaierdo { \ 545132152Smlaier struct mbuf *m, *n = (ifq)->ifq_drv_head; \ 546132152Smlaier while((m = n) != NULL) { \ 547132152Smlaier n = m->m_nextpkt; \ 548130416Smlaier m_freem(m); \ 549130416Smlaier } \ 550130416Smlaier (ifq)->ifq_drv_head = (ifq)->ifq_drv_tail = NULL; \ 551130416Smlaier (ifq)->ifq_drv_len = 0; \ 552130416Smlaier IFQ_PURGE(ifq); \ 553130416Smlaier} while (0) 554130416Smlaier 555186207Skmacy#ifdef _KERNEL 556186213Skmacystatic __inline void 557186213Skmacydrbr_stats_update(struct ifnet *ifp, int len, int mflags) 558186213Skmacy{ 559186213Skmacy 560186213Skmacy ifp->if_obytes += len; 561186213Skmacy if (mflags & M_MCAST) 562186213Skmacy ifp->if_omcasts++; 563186213Skmacy} 564186213Skmacy 565186207Skmacystatic __inline int 566186213Skmacydrbr_enqueue(struct ifnet *ifp, struct buf_ring *br, struct mbuf *m) 567186207Skmacy{ 568186207Skmacy int error = 0; 569186213Skmacy int len = m->m_pkthdr.len; 570186213Skmacy int mflags = m->m_flags; 571186207Skmacy 572191033Skmacy#ifdef ALTQ 573191033Skmacy if (ALTQ_IS_ENABLED(&ifp->if_snd)) { 574191033Skmacy IFQ_ENQUEUE(&ifp->if_snd, m, error); 575191033Skmacy return (error); 576191033Skmacy } 577191033Skmacy#endif 578186207Skmacy if ((error = buf_ring_enqueue(br, m)) == ENOBUFS) { 579186207Skmacy br->br_drops++; 580186213Skmacy _IF_DROP(&ifp->if_snd); 581186207Skmacy m_freem(m); 582186213Skmacy } else 583186213Skmacy drbr_stats_update(ifp, len, mflags); 584186213Skmacy 585186207Skmacy return (error); 586186207Skmacy} 587186207Skmacy 588186207Skmacystatic __inline void 589186207Skmacydrbr_free(struct buf_ring *br, struct malloc_type *type) 590186207Skmacy{ 591186207Skmacy struct mbuf *m; 592186207Skmacy 593186207Skmacy while ((m = buf_ring_dequeue_sc(br)) != NULL) 594186207Skmacy m_freem(m); 595186207Skmacy 596186207Skmacy buf_ring_free(br, type); 597186207Skmacy} 598191033Skmacy 599191033Skmacystatic __inline struct mbuf * 600191033Skmacydrbr_dequeue(struct ifnet *ifp, struct buf_ring *br) 601191033Skmacy{ 602191033Skmacy#ifdef ALTQ 603191033Skmacy struct mbuf *m; 604191033Skmacy 605191033Skmacy if (ALTQ_IS_ENABLED(&ifp->if_snd)) { 606191033Skmacy IFQ_DRV_DEQUEUE(&ifp->if_snd, m); 607191033Skmacy return (m); 608191033Skmacy } 609186207Skmacy#endif 610191033Skmacy return (buf_ring_dequeue_sc(br)); 611191033Skmacy} 612186207Skmacy 613191033Skmacystatic __inline int 614191033Skmacydrbr_empty(struct ifnet *ifp, struct buf_ring *br) 615191033Skmacy{ 616191033Skmacy#ifdef ALTQ 617191033Skmacy if (ALTQ_IS_ENABLED(&ifp->if_snd)) 618191033Skmacy return (IFQ_DRV_IS_EMPTY(&ifp->if_snd)); 619191033Skmacy#endif 620191033Skmacy return (buf_ring_empty(br)); 621191033Skmacy} 622191033Skmacy#endif 62349459Sbrian/* 62449459Sbrian * 72 was chosen below because it is the size of a TCP/IP 62549459Sbrian * header (40) + the minimum mss (32). 62649459Sbrian */ 62749459Sbrian#define IF_MINMTU 72 62849459Sbrian#define IF_MAXMTU 65535 62949459Sbrian 63055205Speter#endif /* _KERNEL */ 63121259Swollman 63221259Swollman/* 63321259Swollman * The ifaddr structure contains information about one address 63421259Swollman * of an interface. They are maintained by the different address families, 63521259Swollman * are allocated and attached when an address is set, and are linked 63621259Swollman * together so all addresses for an interface can be located. 637128291Sluigi * 638128291Sluigi * NOTE: a 'struct ifaddr' is always at the beginning of a larger 639128291Sluigi * chunk of malloc'ed memory, where we store the three addresses 640128291Sluigi * (ifa_addr, ifa_dstaddr and ifa_netmask) referenced here. 64121259Swollman */ 64221259Swollmanstruct ifaddr { 64321259Swollman struct sockaddr *ifa_addr; /* address of interface */ 64421259Swollman struct sockaddr *ifa_dstaddr; /* other end of p-to-p link */ 64521259Swollman#define ifa_broadaddr ifa_dstaddr /* broadcast address interface */ 64621259Swollman struct sockaddr *ifa_netmask; /* used to determine subnet */ 64767334Sjoe struct if_data if_data; /* not all members are meaningful */ 64821259Swollman struct ifnet *ifa_ifp; /* back-pointer to interface */ 64960938Sjake TAILQ_ENTRY(ifaddr) ifa_link; /* queue macro glue */ 65021259Swollman void (*ifa_rtrequest) /* check or clean routes (+ or -)'d */ 65192725Salfred (int, struct rtentry *, struct rt_addrinfo *); 65221259Swollman u_short ifa_flags; /* mostly rt_flags for cloning */ 65347254Spb u_int ifa_refcnt; /* references to this structure */ 65421259Swollman int ifa_metric; /* cost of going out this interface */ 65528845Sjulian int (*ifa_claim_addr) /* check if an addr goes to this if */ 65692725Salfred (struct ifaddr *, struct sockaddr *); 657108033Shsu struct mtx ifa_mtx; 65821259Swollman}; 65921259Swollman#define IFA_ROUTE RTF_UP /* route installed */ 66021259Swollman 66153541Sshin/* for compatibility with other BSDs */ 66253541Sshin#define ifa_list ifa_link 66353541Sshin 664108033Shsu#define IFA_LOCK_INIT(ifa) \ 665108033Shsu mtx_init(&(ifa)->ifa_mtx, "ifaddr", NULL, MTX_DEF) 666108033Shsu#define IFA_LOCK(ifa) mtx_lock(&(ifa)->ifa_mtx) 667108033Shsu#define IFA_UNLOCK(ifa) mtx_unlock(&(ifa)->ifa_mtx) 668108033Shsu#define IFA_DESTROY(ifa) mtx_destroy(&(ifa)->ifa_mtx) 669108033Shsu 67021404Swollman/* 67152904Sshin * The prefix structure contains information about one prefix 67252904Sshin * of an interface. They are maintained by the different address families, 673108470Sschweikh * are allocated and attached when a prefix or an address is set, 67453541Sshin * and are linked together so all prefixes for an interface can be located. 67552904Sshin */ 67652904Sshinstruct ifprefix { 67752904Sshin struct sockaddr *ifpr_prefix; /* prefix of interface */ 67852904Sshin struct ifnet *ifpr_ifp; /* back-pointer to interface */ 67960938Sjake TAILQ_ENTRY(ifprefix) ifpr_list; /* queue macro glue */ 68052904Sshin u_char ifpr_plen; /* prefix length in bits */ 68152904Sshin u_char ifpr_type; /* protocol dependent prefix type */ 68252904Sshin}; 68352904Sshin 68452904Sshin/* 68521404Swollman * Multicast address structure. This is analogous to the ifaddr 68621404Swollman * structure except that it keeps track of multicast addresses. 68721404Swollman */ 68821404Swollmanstruct ifmultiaddr { 68972084Sphk TAILQ_ENTRY(ifmultiaddr) ifma_link; /* queue macro glue */ 69021434Swollman struct sockaddr *ifma_addr; /* address this membership is for */ 69121434Swollman struct sockaddr *ifma_lladdr; /* link-layer translation, if any */ 69221434Swollman struct ifnet *ifma_ifp; /* back-pointer to interface */ 69321434Swollman u_int ifma_refcount; /* reference count */ 69421434Swollman void *ifma_protospec; /* protocol-specific state, if any */ 695167729Sbms struct ifmultiaddr *ifma_llifma; /* pointer to ifma for ifma_lladdr */ 69621404Swollman}; 69721404Swollman 69855205Speter#ifdef _KERNEL 699108036Shsu#define IFAFREE(ifa) \ 700108036Shsu do { \ 701108036Shsu IFA_LOCK(ifa); \ 702108036Shsu KASSERT((ifa)->ifa_refcnt > 0, \ 703108036Shsu ("ifa %p !(ifa_refcnt > 0)", ifa)); \ 704108036Shsu if (--(ifa)->ifa_refcnt == 0) { \ 705108036Shsu IFA_DESTROY(ifa); \ 706108036Shsu free(ifa, M_IFADDR); \ 707108036Shsu } else \ 708108036Shsu IFA_UNLOCK(ifa); \ 70946568Speter } while (0) 71021259Swollman 711108036Shsu#define IFAREF(ifa) \ 712108036Shsu do { \ 713108036Shsu IFA_LOCK(ifa); \ 714108036Shsu ++(ifa)->ifa_refcnt; \ 715108036Shsu IFA_UNLOCK(ifa); \ 716108033Shsu } while (0) 717108033Shsu 718186199Skmacyextern struct rwlock ifnet_lock; 719108298Shsu#define IFNET_LOCK_INIT() \ 720186199Skmacy rw_init_flags(&ifnet_lock, "ifnet", RW_RECURSE) 721186199Skmacy#define IFNET_WLOCK() rw_wlock(&ifnet_lock) 722186199Skmacy#define IFNET_WUNLOCK() rw_wunlock(&ifnet_lock) 723186199Skmacy#define IFNET_WLOCK_ASSERT() rw_assert(&ifnet_lock, RA_LOCKED) 724186199Skmacy#define IFNET_RLOCK() rw_rlock(&ifnet_lock) 725186199Skmacy#define IFNET_RUNLOCK() rw_runlock(&ifnet_lock) 726108172Shsu 72783130Sjlemonstruct ifindex_entry { 72887914Sjlemon struct ifnet *ife_ifnet; 729130585Sphk struct cdev *ife_dev; 73083130Sjlemon}; 73183130Sjlemon 732191367Srwatson/* 733191367Srwatson * Look up an ifnet given its index; the _ref variant also acquires a 734191367Srwatson * reference that must be freed using if_rele(). It is almost always a bug 735191367Srwatson * to call ifnet_byindex() instead if ifnet_byindex_ref(). 736191367Srwatson */ 737180042Srwatsonstruct ifnet *ifnet_byindex(u_short idx); 738191816Szecstruct ifnet *ifnet_byindex_locked(u_short idx); 739191367Srwatsonstruct ifnet *ifnet_byindex_ref(u_short idx); 740181892Skmacy 741128315Sluigi/* 742128315Sluigi * Given the index, ifaddr_byindex() returns the one and only 743128315Sluigi * link-level ifaddr for the interface. You are not supposed to use 744128315Sluigi * it to traverse the list of addresses associated to the interface. 745128315Sluigi */ 746180042Srwatsonstruct ifaddr *ifaddr_byindex(u_short idx); 747180042Srwatsonstruct cdev *ifdev_byindex(u_short idx); 74883130Sjlemon 749186048Sbz#ifdef VIMAGE_GLOBALS 75021259Swollmanextern struct ifnethead ifnet; 75171791Speterextern struct ifnet *loif; /* first loopback interface */ 75221259Swollmanextern int if_index; 753186048Sbz#endif 754186048Sbzextern int ifqmaxlen; 75521259Swollman 756159781Smlaierint if_addgroup(struct ifnet *, const char *); 757159781Smlaierint if_delgroup(struct ifnet *, const char *); 75892725Salfredint if_addmulti(struct ifnet *, struct sockaddr *, struct ifmultiaddr **); 75992725Salfredint if_allmulti(struct ifnet *, int); 760147256Sbrooksstruct ifnet* if_alloc(u_char); 76192725Salfredvoid if_attach(struct ifnet *); 762191418Srwatsonvoid if_dead(struct ifnet *); 763191816Szecvoid if_grow(void); 76492725Salfredint if_delmulti(struct ifnet *, struct sockaddr *); 765167729Sbmsvoid if_delmulti_ifma(struct ifmultiaddr *); 76692725Salfredvoid if_detach(struct ifnet *); 767192605Szecvoid if_vmove(struct ifnet *, struct vnet *); 768146620Speadarvoid if_purgeaddrs(struct ifnet *); 769177617Ssamvoid if_purgemaddrs(struct ifnet *); 77092725Salfredvoid if_down(struct ifnet *); 771167732Sbmsstruct ifmultiaddr * 772167732Sbms if_findmulti(struct ifnet *, struct sockaddr *); 773147256Sbrooksvoid if_free(struct ifnet *); 774147256Sbrooksvoid if_free_type(struct ifnet *, u_char); 775121816Sbrooksvoid if_initname(struct ifnet *, const char *, int); 776138542Ssamvoid if_link_state_change(struct ifnet *, int); 777103900Sbrooksint if_printf(struct ifnet *, const char *, ...) __printflike(2, 3); 778191161Skmacyvoid if_qflush(struct ifnet *); 779191367Srwatsonvoid if_ref(struct ifnet *); 780191367Srwatsonvoid if_rele(struct ifnet *); 78192725Salfredint if_setlladdr(struct ifnet *, const u_char *, int); 78292725Salfredvoid if_up(struct ifnet *); 78392725Salfred/*void ifinit(void);*/ /* declared in systm.h for main() */ 78492725Salfredint ifioctl(struct socket *, u_long, caddr_t, struct thread *); 78592725Salfredint ifpromisc(struct ifnet *, int); 78692725Salfredstruct ifnet *ifunit(const char *); 787191423Srwatsonstruct ifnet *ifunit_ref(const char *); 78821259Swollman 789185162Skmacyvoid ifq_attach(struct ifaltq *, struct ifnet *ifp); 790185162Skmacyvoid ifq_detach(struct ifaltq *); 791185162Skmacy 79292725Salfredstruct ifaddr *ifa_ifwithaddr(struct sockaddr *); 793162068Sandrestruct ifaddr *ifa_ifwithbroadaddr(struct sockaddr *); 79492725Salfredstruct ifaddr *ifa_ifwithdstaddr(struct sockaddr *); 79592725Salfredstruct ifaddr *ifa_ifwithnet(struct sockaddr *); 79692725Salfredstruct ifaddr *ifa_ifwithroute(int, struct sockaddr *, struct sockaddr *); 797178888Sjulianstruct ifaddr *ifa_ifwithroute_fib(int, struct sockaddr *, struct sockaddr *, u_int); 798178888Sjulian 79992725Salfredstruct ifaddr *ifaof_ifpforaddr(struct sockaddr *, struct ifnet *); 80021259Swollman 80192725Salfredint if_simloop(struct ifnet *ifp, struct mbuf *m, int af, int hlen); 80221434Swollman 803147256Sbrookstypedef void *if_com_alloc_t(u_char type, struct ifnet *ifp); 804147256Sbrookstypedef void if_com_free_t(void *com, u_char type); 805147256Sbrooksvoid if_register_com_alloc(u_char type, if_com_alloc_t *a, if_com_free_t *f); 806147256Sbrooksvoid if_deregister_com_alloc(u_char type); 807147256Sbrooks 80884931Sfjoe#define IF_LLADDR(ifp) \ 809152315Sru LLADDR((struct sockaddr_dl *)((ifp)->if_addr->ifa_addr)) 81084931Sfjoe 81187902Sluigi#ifdef DEVICE_POLLING 812150789Sglebiusenum poll_cmd { POLL_ONLY, POLL_AND_CHECK_STATUS }; 81387902Sluigi 814193096Sattiliotypedef int poll_handler_t(struct ifnet *ifp, enum poll_cmd cmd, int count); 81592725Salfredint ether_poll_register(poll_handler_t *h, struct ifnet *ifp); 81692725Salfredint ether_poll_deregister(struct ifnet *ifp); 81787902Sluigi#endif /* DEVICE_POLLING */ 81887902Sluigi 81955205Speter#endif /* _KERNEL */ 82021259Swollman 82121259Swollman#endif /* !_NET_IF_VAR_H_ */ 822