netisr.h revision 130256
136781Sbde/* 214330Speter * Copyright (c) 1980, 1986, 1989, 1993 314330Speter * The Regents of the University of California. All rights reserved. 414330Speter * 514330Speter * Redistribution and use in source and binary forms, with or without 614330Speter * modification, are permitted provided that the following conditions 714330Speter * are met: 814330Speter * 1. Redistributions of source code must retain the above copyright 914330Speter * notice, this list of conditions and the following disclaimer. 1014330Speter * 2. Redistributions in binary form must reproduce the above copyright 1114330Speter * notice, this list of conditions and the following disclaimer in the 1214330Speter * documentation and/or other materials provided with the distribution. 1314330Speter * 4. Neither the name of the University nor the names of its contributors 1414330Speter * may be used to endorse or promote products derived from this software 1514330Speter * without specific prior written permission. 1614330Speter * 1714330Speter * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 1814330Speter * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1914330Speter * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2014330Speter * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2114330Speter * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2214330Speter * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2314330Speter * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2414330Speter * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2536781Sbde * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2614330Speter * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2714330Speter * SUCH DAMAGE. 2814330Speter * 2914330Speter * @(#)netisr.h 8.1 (Berkeley) 6/10/93 3014330Speter * $FreeBSD: head/sys/net/netisr.h 130256 2004-06-09 02:48:23Z rwatson $ 3114330Speter */ 3214330Speter 3314330Speter#ifndef _NET_NETISR_H_ 3414330Speter#define _NET_NETISR_H_ 3514330Speter 3614330Speter/* 3714330Speter * The networking code runs off software interrupts. 3814330Speter * 3914330Speter * You can switch into the network by doing splnet() and return by splx(). 4014330Speter * The software interrupt level for the network is higher than the software 4114330Speter * level for the clock (so you can enter the network in routines called 4214330Speter * at timeout time). 4314330Speter */ 4414330Speter 4514330Speter/* 4614330Speter * Each ``pup-level-1'' input queue has a bit in a ``netisr'' status 4714330Speter * word which is used to de-multiplex a single software 4814330Speter * interrupt used for scheduling the network code to calls 4914330Speter * on the lowest level routine of each protocol. 5034941Speter */ 5114330Speter#define NETISR_POLL 0 /* polling callback, must be first */ 5214330Speter#define NETISR_IP 2 /* same as AF_INET */ 5314330Speter#define NETISR_ROUTE 14 /* routing socket */ 5414330Speter#define NETISR_AARP 15 /* Appletalk ARP */ 5514330Speter#define NETISR_ATALK2 16 /* Appletalk phase 2 */ 5614330Speter#define NETISR_ATALK1 17 /* Appletalk phase 1 */ 5714330Speter#define NETISR_ARP 18 /* same as AF_LINK */ 5814330Speter#define NETISR_IPX 23 /* same as AF_IPX */ 5914330Speter#define NETISR_USB 25 /* USB soft interrupt */ 6014330Speter#define NETISR_PPP 26 /* PPP soft interrupt */ 6114330Speter#define NETISR_IPV6 27 6214330Speter#define NETISR_NATM 28 6314330Speter#define NETISR_ATM 29 6414380Speter#define NETISR_NETGRAPH 30 6514330Speter#define NETISR_POLLMORE 31 /* polling callback, must be last */ 6614330Speter 6714330Speter 6831795Skato#ifndef LOCORE 6914330Speter#ifdef _KERNEL 7014330Speter 7114330Spetervoid legacy_setsoftnet(void); 7214330Speter 7314330Speterextern volatile unsigned int netisr; /* scheduling bits for network */ 7414330Speter#define schednetisr(anisr) do { \ 7514330Speter atomic_set_rel_int(&netisr, 1 << (anisr)); \ 7614330Speter legacy_setsoftnet(); \ 7714330Speter} while (0) 7814330Speter/* used to atomically schedule multiple netisrs */ 7914330Speter#define schednetisrbits(isrbits) do { \ 8014330Speter atomic_set_rel_int(&netisr, isrbits); \ 8114330Speter legacy_setsoftnet(); \ 8214330Speter} while (0) 8314330Speter 8414330Speterstruct ifqueue; 8514330Speterstruct mbuf; 8614330Speter 8714330Spetertypedef void netisr_t (struct mbuf *); 8814330Speter 8914330Spetervoid netisr_dispatch(int, struct mbuf *); 9014330Speterint netisr_queue(int, struct mbuf *); 9114330Speter#define NETISR_MPSAFE 0x0001 /* ISR does not need Giant */ 9214330Spetervoid netisr_register(int, netisr_t *, struct ifqueue *, int); 9314330Spetervoid netisr_unregister(int); 9414330Speter 9514330Speter#endif 9614330Speter#endif 9714330Speter 9814330Speter#endif 9914330Speter