|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. ! 3: * ! 4: * @APPLE_LICENSE_HEADER_START@ ! 5: * ! 6: * The contents of this file constitute Original Code as defined in and ! 7: * are subject to the Apple Public Source License Version 1.1 (the ! 8: * "License"). You may not use this file except in compliance with the ! 9: * License. Please obtain a copy of the License at ! 10: * http://www.apple.com/publicsource and read it before using this file. ! 11: * ! 12: * This Original Code and all software distributed under the License are ! 13: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER ! 14: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, ! 15: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, ! 16: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the ! 17: * License for the specific language governing rights and limitations ! 18: * under the License. ! 19: * ! 20: * @APPLE_LICENSE_HEADER_END@ ! 21: */ ! 22: /* ! 23: * Mach Operating System ! 24: * Copyright (c) 1987 Carnegie-Mellon University ! 25: * All rights reserved. The CMU software License Agreement specifies ! 26: * the terms and conditions for use and redistribution. ! 27: */ ! 28: ! 29: /* HISTORY ! 30: * 18-May-90 Avadis Tevanian (avie) at NeXT ! 31: * Changed to use sensible priorities (higher numbers -> higher pri). ! 32: * ! 33: * 1-Feb-88 David Golub (dbg) at Carnegie-Mellon University ! 34: * Goofed... netisr thread must run at splnet, because the routines ! 35: * it calls expect to be called from the softnet interrupt (at ! 36: * splnet). ! 37: * ! 38: * 19-Nov-87 David Golub (dbg) at Carnegie-Mellon University ! 39: * Created. ! 40: * ! 41: */ ! 42: ! 43: /* ! 44: * netisr.c ! 45: * ! 46: * Kernel thread for network code. ! 47: */ ! 48: ! 49: ! 50: #include <meta_features.h> ! 51: #include <machine/spl.h> ! 52: #include <net/netisr.h> ! 53: ! 54: #include <kern/thread.h> ! 55: #include <kern/processor.h> ! 56: ! 57: volatile int netisr; ! 58: int soft_net_wakeup; ! 59: ! 60: void netisr_thread_continue(void) ! 61: { ! 62: /* ! 63: * All routines this thread calls expect to be called ! 64: * at splnet. ! 65: */ ! 66: ! 67: while (1) { ! 68: (void) splnet(); ! 69: ! 70: while (netisr != 0) { ! 71: #ifdef NIMP ! 72: #if NIMP > 0 ! 73: if (netisr & (1<<NETISR_IMP)){ ! 74: netisr &= ~(1<<NETISR_IMP); ! 75: impintr(); ! 76: } ! 77: #endif /* NIMP > 0 */ ! 78: #endif /* NIMP */ ! 79: ! 80: #if INET ! 81: if (netisr & (1<<NETISR_IP)){ ! 82: void ipintr(void); ! 83: ! 84: netisr &= ~(1<<NETISR_IP); ! 85: ipintr(); ! 86: } ! 87: if (netisr & (1<<NETISR_ARP)) { ! 88: void arpintr(void); ! 89: ! 90: netisr &= ~(1<<NETISR_ARP); ! 91: arpintr(); ! 92: } ! 93: #endif /* INET */ ! 94: ! 95: if (netisr & (1<<NETISR_BLUE)){ ! 96: void blue_notify(void); ! 97: ! 98: netisr &= ~(1<<NETISR_BLUE); ! 99: blue_notify(); ! 100: } ! 101: ! 102: #if ISO ! 103: if (netisr & (1<<NETISR_ISO)) { ! 104: netisr &= ~(1<<NETISR_ISO); ! 105: isointr(); ! 106: } ! 107: #endif /* ISO */ ! 108: ! 109: #if CCITT ! 110: if (netisr & (1<<NETISR_CCITT)) { ! 111: netisr &= ~(1<<NETISR_CCITT); ! 112: ccittintr(); ! 113: } ! 114: #endif /* CCITT */ ! 115: ! 116: #if NS ! 117: if (netisr & (1<<NETISR_NS)){ ! 118: netisr &= ~(1<<NETISR_NS); ! 119: nsintr(); ! 120: } ! 121: #endif /* NS */ ! 122: ! 123: #if NETAT ! 124: if (netisr & (1<<NETISR_APPLETALK)){ ! 125: void atalkintr(void); ! 126: ! 127: netisr &= ~(1<<NETISR_APPLETALK); ! 128: atalkintr(); ! 129: } ! 130: #endif /* NETAT */ ! 131: } ! 132: assert_wait(&soft_net_wakeup, THREAD_UNINT); ! 133: thread_block(netisr_thread_continue); ! 134: /* NOTREACHED */ ! 135: } ! 136: } ! 137: ! 138: void netisr_thread(void) ! 139: { ! 140: register thread_t self = current_thread(); ! 141: extern void stack_privilege(thread_t thread); ! 142: ! 143: /* ! 144: * Make sure that this thread ! 145: * always has a kernel stack, and ! 146: * bind it to the master cpu. ! 147: */ ! 148: stack_privilege(self); ! 149: #if NCPUS > 1 ! 150: thread_bind(self, master_processor); ! 151: #endif ! 152: netisr_thread_continue(); ! 153: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.