ifq.h (132152) | ifq.h (132712) |
---|---|
1/* 2 * Copyright (c) 1982, 1986, 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 13 unchanged lines hidden (view full) --- 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * From: @(#)if.h 8.1 (Berkeley) 6/10/93 | 1/* 2 * Copyright (c) 1982, 1986, 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 13 unchanged lines hidden (view full) --- 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * From: @(#)if.h 8.1 (Berkeley) 6/10/93 |
30 * $FreeBSD: head/sys/net/if_var.h 132152 2004-07-14 13:31:41Z mlaier $ | 30 * $FreeBSD: head/sys/net/if_var.h 132712 2004-07-27 23:20:45Z rwatson $ |
31 */ 32 33#ifndef _NET_IF_VAR_H_ 34#define _NET_IF_VAR_H_ 35 36/* 37 * Structures defining a network interface, providing a packet 38 * transport mechanism (ala level 0 of the PUP protocols). --- 35 unchanged lines hidden (view full) --- 74 75#ifdef _KERNEL 76#include <sys/mbuf.h> 77#include <sys/eventhandler.h> 78#endif /* _KERNEL */ 79#include <sys/lock.h> /* XXX */ 80#include <sys/mutex.h> /* XXX */ 81#include <sys/event.h> /* XXX */ | 31 */ 32 33#ifndef _NET_IF_VAR_H_ 34#define _NET_IF_VAR_H_ 35 36/* 37 * Structures defining a network interface, providing a packet 38 * transport mechanism (ala level 0 of the PUP protocols). --- 35 unchanged lines hidden (view full) --- 74 75#ifdef _KERNEL 76#include <sys/mbuf.h> 77#include <sys/eventhandler.h> 78#endif /* _KERNEL */ 79#include <sys/lock.h> /* XXX */ 80#include <sys/mutex.h> /* XXX */ 81#include <sys/event.h> /* XXX */ |
82#include <sys/_task.h> |
|
82 83#define IF_DUNIT_NONE -1 84 85#if 1 /* ALTQ */ 86#include <altq/if_altq.h> 87#endif 88 89TAILQ_HEAD(ifnethead, ifnet); /* we use TAILQs so that the order of */ --- 96 unchanged lines hidden (view full) --- 186 187 struct label *if_label; /* interface MAC label */ 188 189 /* these are only used by IPv6 */ 190 struct ifprefixhead if_prefixhead; /* list of prefixes per if */ 191 void *if_afdata[AF_MAX]; 192 int if_afdata_initialized; 193 struct mtx if_afdata_mtx; | 83 84#define IF_DUNIT_NONE -1 85 86#if 1 /* ALTQ */ 87#include <altq/if_altq.h> 88#endif 89 90TAILQ_HEAD(ifnethead, ifnet); /* we use TAILQs so that the order of */ --- 96 unchanged lines hidden (view full) --- 187 188 struct label *if_label; /* interface MAC label */ 189 190 /* these are only used by IPv6 */ 191 struct ifprefixhead if_prefixhead; /* list of prefixes per if */ 192 void *if_afdata[AF_MAX]; 193 int if_afdata_initialized; 194 struct mtx if_afdata_mtx; |
195 struct task if_starttask; /* task for IFF_NEEDSGIANT */ |
|
194}; 195 196typedef void if_init_f_t(void *); 197 198/* 199 * XXX These aliases are terribly dangerous because they could apply 200 * to anything. 201 */ --- 122 unchanged lines hidden (view full) --- 324#define IF_AFDATA_UNLOCK(ifp) mtx_unlock(&(ifp)->if_afdata_mtx) 325#define IF_AFDATA_DESTROY(ifp) mtx_destroy(&(ifp)->if_afdata_mtx) 326 327#define IF_HANDOFF(ifq, m, ifp) \ 328 if_handoff((struct ifqueue *)ifq, m, ifp, 0) 329#define IF_HANDOFF_ADJ(ifq, m, ifp, adj) \ 330 if_handoff((struct ifqueue *)ifq, m, ifp, adj) 331 | 196}; 197 198typedef void if_init_f_t(void *); 199 200/* 201 * XXX These aliases are terribly dangerous because they could apply 202 * to anything. 203 */ --- 122 unchanged lines hidden (view full) --- 326#define IF_AFDATA_UNLOCK(ifp) mtx_unlock(&(ifp)->if_afdata_mtx) 327#define IF_AFDATA_DESTROY(ifp) mtx_destroy(&(ifp)->if_afdata_mtx) 328 329#define IF_HANDOFF(ifq, m, ifp) \ 330 if_handoff((struct ifqueue *)ifq, m, ifp, 0) 331#define IF_HANDOFF_ADJ(ifq, m, ifp, adj) \ 332 if_handoff((struct ifqueue *)ifq, m, ifp, adj) 333 |
334void if_start(struct ifnet *); 335 |
|
332static __inline int 333if_handoff(struct ifqueue *ifq, struct mbuf *m, struct ifnet *ifp, int adjust) 334{ 335 int active = 0; 336 337 IF_LOCK(ifq); 338 if (_IF_QFULL(ifq)) { 339 _IF_DROP(ifq); --- 5 unchanged lines hidden (view full) --- 345 ifp->if_obytes += m->m_pkthdr.len + adjust; 346 if (m->m_flags & (M_BCAST|M_MCAST)) 347 ifp->if_omcasts++; 348 active = ifp->if_flags & IFF_OACTIVE; 349 } 350 _IF_ENQUEUE(ifq, m); 351 IF_UNLOCK(ifq); 352 if (ifp != NULL && !active) | 336static __inline int 337if_handoff(struct ifqueue *ifq, struct mbuf *m, struct ifnet *ifp, int adjust) 338{ 339 int active = 0; 340 341 IF_LOCK(ifq); 342 if (_IF_QFULL(ifq)) { 343 _IF_DROP(ifq); --- 5 unchanged lines hidden (view full) --- 349 ifp->if_obytes += m->m_pkthdr.len + adjust; 350 if (m->m_flags & (M_BCAST|M_MCAST)) 351 ifp->if_omcasts++; 352 active = ifp->if_flags & IFF_OACTIVE; 353 } 354 _IF_ENQUEUE(ifq, m); 355 IF_UNLOCK(ifq); 356 if (ifp != NULL && !active) |
353 (*ifp->if_start)(ifp); | 357 if_start(ifp); |
354 return (1); 355} 356#if 1 /* ALTQ */ 357#define IFQ_ENQUEUE(ifq, m, err) \ 358do { \ 359 IF_LOCK(ifq); \ 360 if (ALTQ_IS_ENABLED(ifq)) \ 361 ALTQ_ENQUEUE(ifq, m, NULL, err); \ --- 107 unchanged lines hidden (view full) --- 469 len = (m)->m_pkthdr.len; \ 470 mflags = (m)->m_flags; \ 471 IFQ_ENQUEUE(&(ifp)->if_snd, m, err); \ 472 if ((err) == 0) { \ 473 (ifp)->if_obytes += len + (adj); \ 474 if (mflags & M_MCAST) \ 475 (ifp)->if_omcasts++; \ 476 if (((ifp)->if_flags & IFF_OACTIVE) == 0) \ | 358 return (1); 359} 360#if 1 /* ALTQ */ 361#define IFQ_ENQUEUE(ifq, m, err) \ 362do { \ 363 IF_LOCK(ifq); \ 364 if (ALTQ_IS_ENABLED(ifq)) \ 365 ALTQ_ENQUEUE(ifq, m, NULL, err); \ --- 107 unchanged lines hidden (view full) --- 473 len = (m)->m_pkthdr.len; \ 474 mflags = (m)->m_flags; \ 475 IFQ_ENQUEUE(&(ifp)->if_snd, m, err); \ 476 if ((err) == 0) { \ 477 (ifp)->if_obytes += len + (adj); \ 478 if (mflags & M_MCAST) \ 479 (ifp)->if_omcasts++; \ 480 if (((ifp)->if_flags & IFF_OACTIVE) == 0) \ |
477 (*(ifp)->if_start)(ifp); \ | 481 if_start(ifp); \ |
478 } \ 479} while (0) 480 481#define IFQ_HANDOFF(ifp, m, err) \ 482 IFQ_HANDOFF_ADJ(ifp, m, 0, err) 483 484#define IFQ_DRV_DEQUEUE(ifq, m) \ 485do { \ --- 213 unchanged lines hidden --- | 482 } \ 483} while (0) 484 485#define IFQ_HANDOFF(ifp, m, err) \ 486 IFQ_HANDOFF_ADJ(ifp, m, 0, err) 487 488#define IFQ_DRV_DEQUEUE(ifq, m) \ 489do { \ --- 213 unchanged lines hidden --- |