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/ip/pktmedium.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 #include "u.h"
    2 #include "../port/lib.h"
    3 #include "mem.h"
    4 #include "dat.h"
    5 #include "fns.h"
    6 #include "../port/error.h"
    7 
    8 #include "ip.h"
    9 
   10 
   11 static void     pktbind(Ipifc*, int, char**);
   12 static void     pktunbind(Ipifc*);
   13 static void     pktbwrite(Ipifc*, Block*, int, uchar*);
   14 static void     pktin(Fs*, Ipifc*, Block*);
   15 
   16 Medium pktmedium =
   17 {
   18 .name=          "pkt",
   19 .hsize=         14,
   20 .mintu=         40,
   21 .maxtu=         4*1024,
   22 .maclen=        6,
   23 .bind=          pktbind,
   24 .unbind=        pktunbind,
   25 .bwrite=        pktbwrite,
   26 .pktin=         pktin,
   27 };
   28 
   29 /*
   30  *  called to bind an IP ifc to an ethernet device
   31  *  called with ifc wlock'd
   32  */
   33 static void
   34 pktbind(Ipifc*, int argc, char **argv)
   35 {
   36         USED(argc, argv);
   37 }
   38 
   39 /*
   40  *  called with ifc wlock'd
   41  */
   42 static void
   43 pktunbind(Ipifc*)
   44 {
   45 }
   46 
   47 /*
   48  *  called by ipoput with a single packet to write
   49  */
   50 static void
   51 pktbwrite(Ipifc *ifc, Block *bp, int, uchar*)
   52 {
   53         /* enqueue onto the conversation's rq */
   54         bp = concatblock(bp);
   55         if(ifc->conv->snoopers.ref > 0)
   56                 qpass(ifc->conv->sq, copyblock(bp, BLEN(bp)));
   57         qpass(ifc->conv->rq, bp);
   58 }
   59 
   60 /*
   61  *  called with ifc rlocked when someone write's to 'data'
   62  */
   63 static void
   64 pktin(Fs *f, Ipifc *ifc, Block *bp)
   65 {
   66         if(ifc->lifc == nil)
   67                 freeb(bp);
   68         else {
   69                 if(ifc->conv->snoopers.ref > 0)
   70                         qpass(ifc->conv->sq, copyblock(bp, BLEN(bp)));
   71                 ipiput4(f, ifc, bp);
   72         }
   73 }
   74 
   75 void
   76 pktmediumlink(void)
   77 {
   78         addipmedium(&pktmedium);
   79 }

Cache object: 0bb2d068c9ff4da1c76dc7a8d78e691f


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