Annotation of kernel/bsd/net/netisr.c, revision 1.1

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

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.