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/sys/mbuf.h

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 /*      $OpenBSD: mbuf.h,v 1.118 2008/11/26 17:36:23 dlg Exp $  */
    2 /*      $NetBSD: mbuf.h,v 1.19 1996/02/09 18:25:14 christos Exp $       */
    3 
    4 /*
    5  * Copyright (c) 1982, 1986, 1988, 1993
    6  *      The Regents of the University of California.  All rights reserved.
    7  *
    8  * Redistribution and use in source and binary forms, with or without
    9  * modification, are permitted provided that the following conditions
   10  * are met:
   11  * 1. Redistributions of source code must retain the above copyright
   12  *    notice, this list of conditions and the following disclaimer.
   13  * 2. Redistributions in binary form must reproduce the above copyright
   14  *    notice, this list of conditions and the following disclaimer in the
   15  *    documentation and/or other materials provided with the distribution.
   16  * 3. Neither the name of the University nor the names of its contributors
   17  *    may be used to endorse or promote products derived from this software
   18  *    without specific prior written permission.
   19  *
   20  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   21  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   22  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   23  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   24  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   25  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   26  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   27  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   28  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   29  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   30  * SUCH DAMAGE.
   31  *
   32  *      @(#)mbuf.h      8.5 (Berkeley) 2/19/95
   33  */
   34 
   35 #include <sys/malloc.h>
   36 #include <sys/pool.h>
   37 #include <sys/queue.h>
   38 
   39 /*
   40  * Mbufs are of a single size, MSIZE (sys/param.h), which
   41  * includes overhead.  An mbuf may add a single "mbuf cluster" of size
   42  * MCLBYTES (also in sys/param.h), which has no additional overhead
   43  * and is used instead of the internal data area; this is done when
   44  * at least MINCLSIZE of data must be stored.
   45  */
   46 
   47 #define MLEN            (MSIZE - sizeof(struct m_hdr))  /* normal data len */
   48 #define MHLEN           (MLEN - sizeof(struct pkthdr))  /* data len w/pkthdr */
   49 
   50 /* smallest amount to put in cluster */
   51 #define MINCLSIZE       (MHLEN + MLEN + 1)
   52 #define M_MAXCOMPRESS   (MHLEN / 2)     /* max amount to copy for compression */
   53 
   54 /* Packet tags structure */
   55 struct m_tag {
   56         SLIST_ENTRY(m_tag)      m_tag_link;     /* List of packet tags */
   57         u_int16_t               m_tag_id;       /* Tag ID */
   58         u_int16_t               m_tag_len;      /* Length of data */
   59 };
   60 
   61 /*
   62  * Macros for type conversion
   63  * mtod(m,t) -  convert mbuf pointer to data pointer of correct type
   64  */
   65 #define mtod(m,t)       ((t)((m)->m_data))
   66 
   67 /* header at beginning of each mbuf: */
   68 struct m_hdr {
   69         struct  mbuf *mh_next;          /* next buffer in chain */
   70         struct  mbuf *mh_nextpkt;       /* next chain in queue/record */
   71         caddr_t mh_data;                /* location of data */
   72         u_int   mh_len;                 /* amount of data in this mbuf */
   73         short   mh_type;                /* type of data in this mbuf */
   74         u_short mh_flags;               /* flags; see below */
   75 };
   76 
   77 /* pf stuff */
   78 struct pkthdr_pf {
   79         void            *hdr;           /* saved hdr pos in mbuf, for ECN */
   80         void            *statekey;      /* pf stackside statekey */
   81         u_int            rtableid;      /* alternate routing table id */
   82         u_int32_t        qid;           /* queue id */
   83         u_int16_t        tag;           /* tag id */
   84         u_int8_t         flags;
   85         u_int8_t         routed;
   86 };
   87 
   88 /* pkthdr_pf.flags */
   89 #define PF_TAG_GENERATED                0x01
   90 #define PF_TAG_FRAGCACHE                0x02
   91 #define PF_TAG_TRANSLATE_LOCALHOST      0x04
   92 #define PF_TAG_DIVERTED                 0x08
   93 
   94 /* record/packet header in first mbuf of chain; valid if M_PKTHDR set */
   95 struct  pkthdr {
   96         struct ifnet            *rcvif;         /* rcv interface */
   97         SLIST_HEAD(packet_tags, m_tag) tags; /* list of packet tags */
   98         int                      len;           /* total packet length */
   99         u_int16_t                csum_flags;    /* checksum flags */
  100         u_int16_t                ether_vtag;    /* Ethernet 802.1p+Q vlan tag */
  101         struct pkthdr_pf         pf;
  102 };
  103 
  104 /* description of external storage mapped into mbuf, valid if M_EXT set */
  105 struct mbuf_ext {
  106         caddr_t ext_buf;                /* start of buffer */
  107                                         /* free routine if not the usual */
  108         void    (*ext_free)(caddr_t, u_int, void *);
  109         void    *ext_arg;               /* argument for ext_free */
  110         u_int   ext_size;               /* size of buffer, for ext_free */
  111         int     ext_type;
  112         struct ifnet* ext_ifp;
  113         int     ext_backend;            /* backend pool the storage came from */
  114         struct mbuf *ext_nextref;
  115         struct mbuf *ext_prevref;
  116 #ifdef DEBUG
  117         const char *ext_ofile;
  118         const char *ext_nfile;
  119         int ext_oline;
  120         int ext_nline;
  121 #endif
  122 };
  123 
  124 struct mbuf {
  125         struct  m_hdr m_hdr;
  126         union {
  127                 struct {
  128                         struct  pkthdr MH_pkthdr;       /* M_PKTHDR set */
  129                         union {
  130                                 struct  mbuf_ext MH_ext; /* M_EXT set */
  131                                 char    MH_databuf[MHLEN];
  132                         } MH_dat;
  133                 } MH;
  134                 char    M_databuf[MLEN];                /* !M_PKTHDR, !M_EXT */
  135         } M_dat;
  136 };
  137 #define m_next          m_hdr.mh_next
  138 #define m_len           m_hdr.mh_len
  139 #define m_data          m_hdr.mh_data
  140 #define m_type          m_hdr.mh_type
  141 #define m_flags         m_hdr.mh_flags
  142 #define m_nextpkt       m_hdr.mh_nextpkt
  143 #define m_act           m_nextpkt
  144 #define m_pkthdr        M_dat.MH.MH_pkthdr
  145 #define m_ext           M_dat.MH.MH_dat.MH_ext
  146 #define m_pktdat        M_dat.MH.MH_dat.MH_databuf
  147 #define m_dat           M_dat.M_databuf
  148 
  149 /* mbuf flags */
  150 #define M_EXT           0x0001  /* has associated external storage */
  151 #define M_PKTHDR        0x0002  /* start of record */
  152 #define M_EOR           0x0004  /* end of record */
  153 #define M_CLUSTER       0x0008  /* external storage is a cluster */
  154 #define M_PROTO1        0x0010  /* protocol-specific */
  155 
  156 /* mbuf pkthdr flags, also in m_flags */
  157 #define M_VLANTAG       0x0020  /* ether_vtag is valid */
  158 #define M_LOOP          0x0040  /* for Mbuf statistics */
  159 #define M_FILDROP       0x0080  /* dropped by bpf filter */
  160 #define M_BCAST         0x0100  /* send/received as link-level broadcast */
  161 #define M_MCAST         0x0200  /* send/received as link-level multicast */
  162 #define M_CONF          0x0400  /* payload was encrypted (ESP-transport) */
  163 #define M_AUTH          0x0800  /* payload was authenticated (AH or ESP auth) */
  164 #define M_TUNNEL        0x1000  /* IP-in-IP added by tunnel mode IPsec */
  165 #define M_AUTH_AH       0x2000  /* header was authenticated (AH) */
  166 #define M_LINK0         0x8000  /* link layer specific flag */
  167 
  168 /* flags copied when copying m_pkthdr */
  169 #define M_COPYFLAGS     (M_PKTHDR|M_EOR|M_PROTO1|M_BCAST|M_MCAST|M_CONF|\
  170                          M_AUTH|M_LOOP|M_TUNNEL|M_LINK0|M_VLANTAG|M_FILDROP)
  171 
  172 /* Checksumming flags */
  173 #define M_IPV4_CSUM_OUT         0x0001  /* IPv4 checksum needed */
  174 #define M_TCPV4_CSUM_OUT        0x0002  /* TCP checksum needed */
  175 #define M_UDPV4_CSUM_OUT        0x0004  /* UDP checksum needed */
  176 #define M_IPV4_CSUM_IN_OK       0x0008  /* IPv4 checksum verified */
  177 #define M_IPV4_CSUM_IN_BAD      0x0010  /* IPv4 checksum bad */
  178 #define M_TCP_CSUM_IN_OK        0x0020  /* TCP/IPv4 checksum verified */
  179 #define M_TCP_CSUM_IN_BAD       0x0040  /* TCP/IPv4 checksum bad */
  180 #define M_UDP_CSUM_IN_OK        0x0080  /* UDP/IPv4 checksum verified */
  181 #define M_UDP_CSUM_IN_BAD       0x0100  /* UDP/IPv4 checksum bad */
  182 
  183 /* mbuf types */
  184 #define MT_FREE         0       /* should be on free list */
  185 #define MT_DATA         1       /* dynamic (data) allocation */
  186 #define MT_HEADER       2       /* packet header */
  187 #define MT_SONAME       3       /* socket name */
  188 #define MT_SOOPTS       4       /* socket options */
  189 #define MT_FTABLE       5       /* fragment reassembly header */
  190 #define MT_CONTROL      6       /* extra-data protocol message */
  191 #define MT_OOBDATA      7       /* expedited data  */
  192 
  193 /* flags to m_get/MGET */
  194 #define M_DONTWAIT      M_NOWAIT
  195 #define M_WAIT          M_WAITOK
  196 
  197 /*
  198  * mbuf allocation/deallocation macros:
  199  *
  200  *      MGET(struct mbuf *m, int how, int type)
  201  * allocates an mbuf and initializes it to contain internal data.
  202  *
  203  *      MGETHDR(struct mbuf *m, int how, int type)
  204  * allocates an mbuf and initializes it to contain a packet header
  205  * and internal data.
  206  */
  207 #define MGET(m, how, type) m = m_get((how), (type))
  208 
  209 #define MGETHDR(m, how, type) m = m_gethdr((how), (type))
  210 
  211 /*
  212  * Macros for tracking external storage associated with an mbuf.
  213  *
  214  * Note: add and delete reference must be called at splvm().
  215  */
  216 #ifdef DEBUG
  217 #define MCLREFDEBUGN(m, file, line) do {                                \
  218                 (m)->m_ext.ext_nfile = (file);                          \
  219                 (m)->m_ext.ext_nline = (line);                          \
  220         } while (/* CONSTCOND */ 0)
  221 #define MCLREFDEBUGO(m, file, line) do {                                \
  222                 (m)->m_ext.ext_ofile = (file);                          \
  223                 (m)->m_ext.ext_oline = (line);                          \
  224         } while (/* CONSTCOND */ 0)
  225 #else
  226 #define MCLREFDEBUGN(m, file, line)
  227 #define MCLREFDEBUGO(m, file, line)
  228 #endif
  229 
  230 #define MCLISREFERENCED(m)      ((m)->m_ext.ext_nextref != (m))
  231 
  232 #define MCLADDREFERENCE(o, n)   do {                                    \
  233                 int ms =  splvm();                                      \
  234                 (n)->m_flags |= ((o)->m_flags & (M_EXT|M_CLUSTER));     \
  235                 (n)->m_ext.ext_nextref = (o)->m_ext.ext_nextref;        \
  236                 (n)->m_ext.ext_prevref = (o);                           \
  237                 (o)->m_ext.ext_nextref = (n);                           \
  238                 (n)->m_ext.ext_nextref->m_ext.ext_prevref = (n);        \
  239                 splx(ms);                                               \
  240                 MCLREFDEBUGN((n), __FILE__, __LINE__);                  \
  241         } while (/* CONSTCOND */ 0)
  242 
  243 #define MCLINITREFERENCE(m)     do {                                    \
  244                 (m)->m_ext.ext_prevref = (m);                           \
  245                 (m)->m_ext.ext_nextref = (m);                           \
  246                 MCLREFDEBUGO((m), __FILE__, __LINE__);                  \
  247                 MCLREFDEBUGN((m), NULL, 0);                             \
  248         } while (/* CONSTCOND */ 0)
  249 
  250 /*
  251  * Macros for mbuf external storage.
  252  *
  253  * MEXTADD adds pre-allocated external storage to
  254  * a normal mbuf; the flag M_EXT is set.
  255  *
  256  * MCLGET allocates and adds an mbuf cluster to a normal mbuf;
  257  * the flag M_EXT is set upon success.
  258  */
  259 #define MEXTADD(m, buf, size, type, free, arg) do {                     \
  260         (m)->m_data = (m)->m_ext.ext_buf = (caddr_t)(buf);              \
  261         (m)->m_flags |= M_EXT;                                          \
  262         (m)->m_flags &= ~M_CLUSTER;                                     \
  263         (m)->m_ext.ext_size = (size);                                   \
  264         (m)->m_ext.ext_free = (free);                                   \
  265         (m)->m_ext.ext_arg = (arg);                                     \
  266         (m)->m_ext.ext_type = (type);                                   \
  267         MCLINITREFERENCE(m);                                            \
  268 } while (/* CONSTCOND */ 0)
  269 
  270 #define MCLGET(m, how) m_clget((m), (how), NULL, MCLBYTES)
  271 #define MCLGETI(m, how, ifp, l) m_clget((m), (how), (ifp), (l))
  272 
  273 /*
  274  * MFREE(struct mbuf *m, struct mbuf *n)
  275  * Free a single mbuf and associated external storage.
  276  * Place the successor, if any, in n.
  277  */
  278 #define MFREE(m, n) n = m_free((m))
  279 
  280 /*
  281  * Move just m_pkthdr from from to to,
  282  * remove M_PKTHDR and clean the tag for from.
  283  */
  284 #define M_MOVE_HDR(to, from) do {                                       \
  285         (to)->m_pkthdr = (from)->m_pkthdr;                              \
  286         (from)->m_flags &= ~M_PKTHDR;                                   \
  287         SLIST_INIT(&(from)->m_pkthdr.tags);                             \
  288 } while (/* CONSTCOND */ 0)
  289 
  290 /*
  291  * Duplicate just m_pkthdr from from to to.
  292  */
  293 #define M_DUP_HDR(to, from) do {                                        \
  294         (to)->m_pkthdr = (from)->m_pkthdr;                              \
  295         SLIST_INIT(&(to)->m_pkthdr.tags);                               \
  296         m_tag_copy_chain((to), (from));                                 \
  297 } while (/* CONSTCOND */ 0)
  298 
  299 /*
  300  * Duplicate mbuf pkthdr from from to to.
  301  * from must have M_PKTHDR set, and to must be empty.
  302  */
  303 #define M_DUP_PKTHDR(to, from) do {                                     \
  304         (to)->m_flags = ((to)->m_flags & (M_EXT | M_CLUSTER));          \
  305         (to)->m_flags |= (from)->m_flags & M_COPYFLAGS;                 \
  306         M_DUP_HDR((to), (from));                                        \
  307         if (((to)->m_flags & M_EXT) == 0)                               \
  308                 (to)->m_data = (to)->m_pktdat;                          \
  309 } while (/* CONSTCOND */ 0)
  310 
  311 /*
  312  * MOVE mbuf pkthdr from from to to.
  313  * from must have M_PKTHDR set, and to must be empty.
  314  */
  315 #define M_MOVE_PKTHDR(to, from) do {                                    \
  316         (to)->m_flags = ((to)->m_flags & (M_EXT | M_CLUSTER));          \
  317         (to)->m_flags |= (from)->m_flags & M_COPYFLAGS;                 \
  318         M_MOVE_HDR((to), (from));                                       \
  319         if (((to)->m_flags & M_EXT) == 0)                               \
  320                 (to)->m_data = (to)->m_pktdat;                          \
  321 } while (/* CONSTCOND */ 0)
  322 
  323 /*
  324  * Set the m_data pointer of a newly-allocated mbuf (m_get/MGET) to place
  325  * an object of the specified size at the end of the mbuf, longword aligned.
  326  */
  327 #define M_ALIGN(m, len) \
  328         (m)->m_data += (MLEN - (len)) &~ (sizeof(long) - 1)
  329 /*
  330  * As above, for mbufs allocated with m_gethdr/MGETHDR
  331  * or initialized by M_MOVE_PKTHDR.
  332  */
  333 #define MH_ALIGN(m, len) \
  334         (m)->m_data += (MHLEN - (len)) &~ (sizeof(long) - 1)
  335 
  336 /*
  337  * Determine if an mbuf's data area is read-only. This is true for
  338  * non-cluster external storage and for clusters that are being
  339  * referenced by more than one mbuf.
  340  */
  341 #define M_READONLY(m)                                                   \
  342         (((m)->m_flags & M_EXT) != 0 &&                                 \
  343           (((m)->m_flags & M_CLUSTER) == 0 || MCLISREFERENCED(m)))
  344 
  345 /*
  346  * Compute the amount of space available
  347  * before the current start of data in an mbuf.
  348  */
  349 #define M_LEADINGSPACE(m) m_leadingspace(m)
  350 
  351 /*
  352  * Compute the amount of space available
  353  * after the end of data in an mbuf.
  354  */
  355 #define M_TRAILINGSPACE(m) m_trailingspace(m)
  356 
  357 /*
  358  * Arrange to prepend space of size plen to mbuf m.
  359  * If a new mbuf must be allocated, how specifies whether to wait.
  360  * If how is M_DONTWAIT and allocation fails, the original mbuf chain
  361  * is freed and m is set to NULL.
  362  */
  363 #define M_PREPEND(m, plen, how) do {                                    \
  364         if (M_LEADINGSPACE(m) >= (plen)) {                              \
  365                 (m)->m_data -= (plen);                                  \
  366                 (m)->m_len += (plen);                                   \
  367         } else                                                          \
  368                 (m) = m_prepend((m), (plen), (how));                    \
  369         if ((m) && (m)->m_flags & M_PKTHDR)                             \
  370                 (m)->m_pkthdr.len += (plen);                            \
  371 } while (/* CONSTCOND */ 0)
  372 
  373 /* length to m_copy to copy all */
  374 #define M_COPYALL       1000000000
  375 
  376 /* compatibility with 4.3 */
  377 #define  m_copy(m, o, l)        m_copym((m), (o), (l), M_DONTWAIT)
  378 
  379 /*
  380  * Mbuf statistics.
  381  * For statistics related to mbuf and cluster allocations, see also the
  382  * pool headers (mbpool and mclpool).
  383  */
  384 struct mbstat {
  385         u_long  _m_spare;       /* formerly m_mbufs */
  386         u_long  _m_spare1;      /* formerly m_clusters */
  387         u_long  _m_spare2;      /* spare field */
  388         u_long  _m_spare3;      /* formely m_clfree - free clusters */
  389         u_long  m_drops;        /* times failed to find space */
  390         u_long  m_wait;         /* times waited for space */
  391         u_long  m_drain;        /* times drained protocols for space */
  392         u_short m_mtypes[256];  /* type specific mbuf allocations */
  393 };
  394 
  395 #ifdef  _KERNEL
  396 
  397 struct  mclsizes {
  398         u_int   size;
  399         u_int   hwm;
  400 };
  401 
  402 extern  struct mbstat mbstat;
  403 extern  int nmbclust;                   /* limit on the # of clusters */
  404 extern  int mblowat;                    /* mbuf low water mark */
  405 extern  int mcllowat;                   /* mbuf cluster low water mark */
  406 extern  int max_linkhdr;                /* largest link-level header */
  407 extern  int max_protohdr;               /* largest protocol header */
  408 extern  int max_hdr;                    /* largest link+protocol header */
  409 extern  int max_datalen;                /* MHLEN - max_hdr */
  410 extern  int mbtypes[];                  /* XXX */
  411 
  412 void    mbinit(void);
  413 struct  mbuf *m_copym2(struct mbuf *, int, int, int);
  414 struct  mbuf *m_copym(struct mbuf *, int, int, int);
  415 struct  mbuf *m_free(struct mbuf *);
  416 struct  mbuf *m_get(int, int);
  417 struct  mbuf *m_getclr(int, int);
  418 struct  mbuf *m_gethdr(int, int);
  419 struct  mbuf *m_inithdr(struct mbuf *);
  420 int           m_defrag(struct mbuf *, int);
  421 struct  mbuf *m_prepend(struct mbuf *, int, int);
  422 struct  mbuf *m_pulldown(struct mbuf *, int, int, int *);
  423 struct  mbuf *m_pullup(struct mbuf *, int);
  424 struct  mbuf *m_pullup2(struct mbuf *, int);
  425 struct  mbuf *m_split(struct mbuf *, int, int);
  426 struct  mbuf *m_inject(struct mbuf *, int, int, int);
  427 struct  mbuf *m_getptr(struct mbuf *, int, int *);
  428 int     m_leadingspace(struct mbuf *);
  429 int     m_trailingspace(struct mbuf *);
  430 void    m_clget(struct mbuf *, int, struct ifnet *, u_int);
  431 void    m_clsetlwm(struct ifnet *, u_int, u_int);
  432 int     m_cldrop(struct ifnet *, int);
  433 void    m_clcount(struct ifnet *, int);
  434 void    m_cluncount(struct mbuf *, int);
  435 void    m_adj(struct mbuf *, int);
  436 void    m_copyback(struct mbuf *, int, int, const void *);
  437 void    m_freem(struct mbuf *);
  438 void    m_reclaim(void *, int);
  439 void    m_copydata(struct mbuf *, int, int, caddr_t);
  440 void    m_cat(struct mbuf *, struct mbuf *);
  441 struct mbuf *m_devget(char *, int, int, struct ifnet *,
  442             void (*)(const void *, void *, size_t));
  443 void    m_zero(struct mbuf *);
  444 int     m_apply(struct mbuf *, int, int,
  445             int (*)(caddr_t, caddr_t, unsigned int), caddr_t);
  446 
  447 /* Packet tag routines */
  448 struct m_tag *m_tag_get(int, int, int);
  449 void    m_tag_prepend(struct mbuf *, struct m_tag *);
  450 void    m_tag_delete(struct mbuf *, struct m_tag *);
  451 void    m_tag_delete_chain(struct mbuf *);
  452 struct m_tag *m_tag_find(struct mbuf *, int, struct m_tag *);
  453 struct m_tag *m_tag_copy(struct m_tag *);
  454 int     m_tag_copy_chain(struct mbuf *, struct mbuf *);
  455 void    m_tag_init(struct mbuf *);
  456 struct m_tag *m_tag_first(struct mbuf *);
  457 struct m_tag *m_tag_next(struct mbuf *, struct m_tag *);
  458 
  459 /* Packet tag types */
  460 #define PACKET_TAG_NONE                         0  /* Nadda */
  461 #define PACKET_TAG_IPSEC_IN_DONE                1  /* IPsec applied, in */
  462 #define PACKET_TAG_IPSEC_OUT_DONE               2  /* IPsec applied, out */
  463 #define PACKET_TAG_IPSEC_IN_CRYPTO_DONE         3  /* NIC IPsec crypto done */
  464 #define PACKET_TAG_IPSEC_OUT_CRYPTO_NEEDED      4  /* NIC IPsec crypto req'ed */
  465 #define PACKET_TAG_IPSEC_IN_COULD_DO_CRYPTO     5  /* NIC notifies IPsec */
  466 #define PACKET_TAG_IPSEC_PENDING_TDB            6  /* Reminder to do IPsec */
  467 #define PACKET_TAG_BRIDGE                       7  /* Bridge processing done */
  468 #define PACKET_TAG_GIF                          8  /* GIF processing done */
  469 #define PACKET_TAG_GRE                          9  /* GRE processing done */
  470 #define PACKET_TAG_IN_PACKET_CHECKSUM           10 /* NIC checksumming done */
  471 #define PACKET_TAG_DLT                          17 /* data link layer type */
  472 #define PACKET_TAG_PF_DIVERT                    18 /* pf(4) diverted packet */
  473 
  474 #ifdef MBTYPES
  475 int mbtypes[] = {                               /* XXX */
  476         M_FREE,         /* MT_FREE      0          should be on free list */
  477         M_MBUF,         /* MT_DATA      1          dynamic (data) allocation */
  478         M_MBUF,         /* MT_HEADER    2          packet header */
  479         M_MBUF,         /* MT_SONAME    8          socket name */
  480         M_SOOPTS,       /* MT_SOOPTS    10         socket options */
  481         M_FTABLE,       /* MT_FTABLE    11         fragment reassembly header */
  482         M_MBUF,         /* MT_CONTROL   14         extra-data protocol message */
  483         M_MBUF,         /* MT_OOBDATA   15         expedited data  */
  484 };
  485 #endif /* MBTYPES */
  486 #endif

Cache object: 92683ab26a8c4dc230da49aa9295b44a


[ 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.