The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/net/intrq.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * Copyright (c) 2000 Brian Somers <brian@Awfulhak.org>
    3  * 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
    9  *    notice, this list of conditions and the following disclaimer.
   10  * 2. Redistributions in binary form must reproduce the above copyright
   11  *    notice, this list of conditions and the following disclaimer in the
   12  *    documentation and/or other materials provided with the distribution.
   13  *
   14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   15  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   17  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   18  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   19  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   20  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   21  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   22  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   23  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   24  * SUCH DAMAGE.
   25  *
   26  * $FreeBSD: releng/5.0/sys/net/intrq.c 89069 2002-01-08 10:34:03Z msmith $
   27  */
   28 
   29 #include <sys/param.h>
   30 #include <sys/mbuf.h>
   31 #include <sys/random.h>
   32 #include <sys/socket.h>
   33 #include <sys/systm.h>
   34 #include <sys/time.h>
   35 
   36 #include <net/if.h>
   37 #include <net/if_var.h>
   38 #include <net/netisr.h>
   39 #include <net/intrq.h>
   40 
   41 /*
   42  * If the appropriate intrq_present variable is zero, don't use
   43  * the queue (as it'll never get processed).
   44  * Each of the active network stacks sets their own
   45  * *intrq_present variable non-zero.
   46  */
   47 int     atintrq1_present;
   48 int     atintrq2_present;
   49 int     atmintrq_present;
   50 int     ipintrq_present;
   51 int     ip6intrq_present;
   52 int     ipxintrq_present;
   53 int     natmintrq_present;
   54 int     nsintrq_present;
   55 
   56 struct ifqueue  atintrq1;
   57 struct ifqueue  atintrq2;
   58 struct ifqueue  atm_intrq;
   59 struct ifqueue  ipintrq;
   60 struct ifqueue  ip6intrq;
   61 struct ifqueue  ipxintrq;
   62 struct ifqueue  natmintrq;
   63 struct ifqueue  nsintrq;
   64 
   65 
   66 static const struct {
   67         sa_family_t family;
   68         struct ifqueue *q;
   69         int const *present;
   70         int isr;
   71 } queue[] = {
   72         { AF_ATM, &atm_intrq, &atmintrq_present, NETISR_ATM },
   73         { AF_INET, &ipintrq, &ipintrq_present, NETISR_IP },
   74         { AF_INET6, &ip6intrq, &ip6intrq_present, NETISR_IPV6 },
   75         { AF_IPX, &ipxintrq, &ipxintrq_present, NETISR_IPX },
   76         { AF_NATM, &natmintrq, &natmintrq_present, NETISR_NATM },
   77         { AF_APPLETALK, &atintrq2, &atintrq2_present, NETISR_ATALK },
   78         { AF_NS, &nsintrq, &nsintrq_present, NETISR_NS }
   79 };
   80 
   81 int
   82 family_enqueue(family, m)
   83         sa_family_t family;
   84         struct mbuf *m;
   85 {
   86         int entry;
   87 
   88         for (entry = 0; entry < sizeof queue / sizeof queue[0]; entry++)
   89                 if (queue[entry].family == family) {
   90                         if (queue[entry].present) {
   91                                 if (! IF_HANDOFF(queue[entry].q, m, NULL))
   92                                         return ENOBUFS;
   93                                 schednetisr(queue[entry].isr);
   94                                 /* First chunk of an mbuf contains good junk */
   95                                 if (harvest.point_to_point)
   96                                         random_harvest(m, 16, 3, 0, RANDOM_NET);
   97                                 return 0;
   98                         } else
   99                                 break;
  100                 }
  101 
  102         m_freem(m);
  103         return EAFNOSUPPORT;
  104 }

Cache object: 8e7fdbd81fd1584a8198950d25303460


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.