summaryrefslogtreecommitdiffstats
path: root/sys/sys/mbuf.h
Commit message (Collapse)AuthorAgeFilesLines
* Provide a function m_get2() that allocates a minimal mbuf thatglebius2012-01-171-0/+48
| | | | | | would fit specified size. Returned mbuf may be a single mbuf, an mbuf with a cluster from packet zone, or an mbuf with jumbo cluster of sufficient size.
* Make panic strings in m_gettype(), m_getzone(), m_cljset()glebius2012-01-161-3/+3
| | | | consistent.
* m_getzone() should return only cluster zones.glebius2012-01-161-3/+0
|
* Update packet filter (pf) code to OpenBSD 4.5.bz2011-06-281-0/+10
| | | | | | | | You need to update userland (world and ports) tools to be in sync with the kernel. Submitted by: mlaier Submitted by: eri
* Correct a last minute merge error for new M_HASHTYPE macros. This didn'trwatson2011-06-051-1/+1
| | | | | | | turn up as a build problem because the macros aren't used (yet). MFC after: 3 days Sponsored by: Juniper Networks, Inc.
* Allocate four bits from the mbuf flags field to represent the hashrwatson2011-06-041-2/+38
| | | | | | | | | | | | | | | | | | | type of a software- or hardware-generated hash held in the mbuf.m_pkthdr.flowid field, and provide accessor macros to easily clear, set, receive, and test for hash values. Some of these constants correspond to RSS hash types, but we don't want to limit ourselves to that, as a number of other hashing techniques are in use on hardware supported by FreeBSD. Mark the M_FLOWID flag as deprecated; I hope to remove this before 9.0, changing drivers and the stack over to using the new M_HASHTYPEBITS, most likely to use M_HASHTYPE_OPAQUE as we don't yet want to nail down the KPI for RSS key/bucket management for device drivers. MFC after: 3 days Reviewed by: bz Sponsored by: Juniper Networks, Inc.
* MFp4: anchie_soc2009 branch:anchie2010-08-191-0/+1
| | | | | | | | | | | | | | | | | | | | Add kernel side support for Secure Neighbor Discovery (SeND), RFC 3971. The implementation consists of a kernel module that gets packets from the nd6 code, sends them to user space on a dedicated socket and reinjects them back for further processing. Hooks are used from nd6 code paths to divert relevant packets to the send implementation for processing in user space. The hooks are only triggered if the send module is loaded. In case no user space application is connected to the send socket, processing continues normaly as if the module would not be loaded. Unloading the module is not possible at this time due to missing nd6 locking. The native SeND socket is similar to a raw IPv6 socket but with its own, internal pseudo-protocol. Approved by: bz (mentor)
* Revert r210225 - turns out I was wrong; the "/*-" is not license-onlytrasz2010-07-181-2/+2
| | | | | | | thing; it's also used to indicate that the comment should not be automatically rewrapped. Explained by: cperciva@
* The "/*-" comment marker is supposed to denote copyrights. Remove non-copyrighttrasz2010-07-181-2/+2
| | | | occurences from sys/sys/ and sys/kern/.
* Add a fastpath to allocate from packet zone when using m_getjcl.fabient2010-05-071-0/+3
| | | | | | | This will add support for packet zone for at least igb and ixgbe and will avoid to check for that in bce and mxge. MFC after: 1 week
* Add m_mbuftouio() helper function to copy(out) an arbitraryandre2009-06-221-0/+1
| | | | | | | | | long mbuf chain into an arbitrary large uio in a single step. It is a functional mirror image of m_uiotombuf(). This function is supposed to be used instead of hand rolled code with the same purpose and to concentrate it into one place for potential further optimization or hardware assistance.
* Remove definition of dtom(), which converted a data pointer into arwatson2009-06-201-3/+3
| | | | | | pointer to the containing mbuf. This eliminates a strong assumption about the layout of network buffer memory, giving us greater flexibility to revise mbuf semantics in the future.
* define helper routines for deferred mbuf initializationkmacy2009-06-191-0/+30
|
* Added support for NAT-Traversal (RFC 3948) in IPsec stack.vanhu2009-06-121-0/+1
| | | | | | | | | | | | | | Thanks to (no special order) Emmanuel Dreyfus (manu@netbsd.org), Larry Baird (lab@gta.com), gnn, bz, and other FreeBSD devs, Julien Vanherzeele (julien.vanherzeele@netasq.com, for years of bug reporting), the PFSense team, and all people who used / tried the NAT-T patch for years and reported bugs, patches, etc... X-MFC: never Reviewed by: bz Approved by: gnn(mentor) Obtained from: NETASQ
* Whitespace (use tabs like for all other lines).bz2009-04-261-1/+1
| | | | MFC after: 1 month
* Import "flowid" support for serializing flows across transmit queueskmacy2009-04-101-0/+1
| | | | Reviewed by: rwatson and jeli
* Overlay a uint16_t field suitable for use by thebms2009-03-041-1/+5
| | | | | | IGMPv3 code. It is used to maintain the number of group records contained in a pending IGMPv3 output mbuf chain.
* Adds flags for SCTP checksum offload. Preprrs2009-01-061-0/+2
| | | | | for support for new Intel NIC's that have this feature.
* Add flowid to mbuf to allow drivers to uniquelykmacy2008-11-221-0/+3
| | | | | identify connection flows to guarantee ordering across queues
* Add code to allow the system to handle multiple routing tables.julian2008-05-091-2/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This particular implementation is designed to be fully backwards compatible and to be MFC-able to 7.x (and 6.x) Currently the only protocol that can make use of the multiple tables is IPv4 Similar functionality exists in OpenBSD and Linux. From my notes: ----- One thing where FreeBSD has been falling behind, and which by chance I have some time to work on is "policy based routing", which allows different packet streams to be routed by more than just the destination address. Constraints: ------------ I want to make some form of this available in the 6.x tree (and by extension 7.x) , but FreeBSD in general needs it so I might as well do it in -current and back port the portions I need. One of the ways that this can be done is to have the ability to instantiate multiple kernel routing tables (which I will now refer to as "Forwarding Information Bases" or "FIBs" for political correctness reasons). Which FIB a particular packet uses to make the next hop decision can be decided by a number of mechanisms. The policies these mechanisms implement are the "Policies" referred to in "Policy based routing". One of the constraints I have if I try to back port this work to 6.x is that it must be implemented as a EXTENSION to the existing ABIs in 6.x so that third party applications do not need to be recompiled in timespan of the branch. This first version will not have some of the bells and whistles that will come with later versions. It will, for example, be limited to 16 tables in the first commit. Implementation method, Compatible version. (part 1) ------------------------------- For this reason I have implemented a "sufficient subset" of a multiple routing table solution in Perforce, and back-ported it to 6.x. (also in Perforce though not always caught up with what I have done in -current/P4). The subset allows a number of FIBs to be defined at compile time (8 is sufficient for my purposes in 6.x) and implements the changes needed to allow IPV4 to use them. I have not done the changes for ipv6 simply because I do not need it, and I do not have enough knowledge of ipv6 (e.g. neighbor discovery) needed to do it. Other protocol families are left untouched and should there be users with proprietary protocol families, they should continue to work and be oblivious to the existence of the extra FIBs. To understand how this is done, one must know that the current FIB code starts everything off with a single dimensional array of pointers to FIB head structures (One per protocol family), each of which in turn points to the trie of routes available to that family. The basic change in the ABI compatible version of the change is to extent that array to be a 2 dimensional array, so that instead of protocol family X looking at rt_tables[X] for the table it needs, it looks at rt_tables[Y][X] when for all protocol families except ipv4 Y is always 0. Code that is unaware of the change always just sees the first row of the table, which of course looks just like the one dimensional array that existed before. The entry points rtrequest(), rtalloc(), rtalloc1(), rtalloc_ign() are all maintained, but refer only to the first row of the array, so that existing callers in proprietary protocols can continue to do the "right thing". Some new entry points are added, for the exclusive use of ipv4 code called in_rtrequest(), in_rtalloc(), in_rtalloc1() and in_rtalloc_ign(), which have an extra argument which refers the code to the correct row. In addition, there are some new entry points (currently called rtalloc_fib() and friends) that check the Address family being looked up and call either rtalloc() (and friends) if the protocol is not IPv4 forcing the action to row 0 or to the appropriate row if it IS IPv4 (and that info is available). These are for calling from code that is not specific to any particular protocol. The way these are implemented would change in the non ABI preserving code to be added later. One feature of the first version of the code is that for ipv4, the interface routes show up automatically on all the FIBs, so that no matter what FIB you select you always have the basic direct attached hosts available to you. (rtinit() does this automatically). You CAN delete an interface route from one FIB should you want to but by default it's there. ARP information is also available in each FIB. It's assumed that the same machine would have the same MAC address, regardless of which FIB you are using to get to it. This brings us as to how the correct FIB is selected for an outgoing IPV4 packet. Firstly, all packets have a FIB associated with them. if nothing has been done to change it, it will be FIB 0. The FIB is changed in the following ways. Packets fall into one of a number of classes. 1/ locally generated packets, coming from a socket/PCB. Such packets select a FIB from a number associated with the socket/PCB. This in turn is inherited from the process, but can be changed by a socket option. The process in turn inherits it on fork. I have written a utility call setfib that acts a bit like nice.. setfib -3 ping target.example.com # will use fib 3 for ping. It is an obvious extension to make it a property of a jail but I have not done so. It can be achieved by combining the setfib and jail commands. 2/ packets received on an interface for forwarding. By default these packets would use table 0, (or possibly a number settable in a sysctl(not yet)). but prior to routing the firewall can inspect them (see below). (possibly in the future you may be able to associate a FIB with packets received on an interface.. An ifconfig arg, but not yet.) 3/ packets inspected by a packet classifier, which can arbitrarily associate a fib with it on a packet by packet basis. A fib assigned to a packet by a packet classifier (such as ipfw) would over-ride a fib associated by a more default source. (such as cases 1 or 2). 4/ a tcp listen socket associated with a fib will generate accept sockets that are associated with that same fib. 5/ Packets generated in response to some other packet (e.g. reset or icmp packets). These should use the FIB associated with the packet being reponded to. 6/ Packets generated during encapsulation. gif, tun and other tunnel interfaces will encapsulate using the FIB that was in effect withthe proces that set up the tunnel. thus setfib 1 ifconfig gif0 [tunnel instructions] will set the fib for the tunnel to use to be fib 1. Routing messages would be associated with their process, and thus select one FIB or another. messages from the kernel would be associated with the fib they refer to and would only be received by a routing socket associated with that fib. (not yet implemented) In addition Netstat has been edited to be able to cope with the fact that the array is now 2 dimensional. (It looks in system memory using libkvm (!)). Old versions of netstat see only the first FIB. In addition two sysctls are added to give: a) the number of FIBs compiled in (active) b) the default FIB of the calling process. Early testing experience: ------------------------- Basically our (IronPort's) appliance does this functionality already using ipfw fwd but that method has some drawbacks. For example, It can't fully simulate a routing table because it can't influence the socket's choice of local address when a connect() is done. Testing during the generating of these changes has been remarkably smooth so far. Multiple tables have co-existed with no notable side effects, and packets have been routes accordingly. ipfw has grown 2 new keywords: setfib N ip from anay to any count ip from any to any fib N In pf there seems to be a requirement to be able to give symbolic names to the fibs but I do not have that capacity. I am not sure if it is required. SCTP has interestingly enough built in support for this, called VRFs in Cisco parlance. it will be interesting to see how that handles it when it suddenly actually does something. Where to next: -------------------- After committing the ABI compatible version and MFCing it, I'd like to proceed in a forward direction in -current. this will result in some roto-tilling in the routing code. Firstly: the current code's idea of having a separate tree per protocol family, all of the same format, and pointed to by the 1 dimensional array is a bit silly. Especially when one considers that there is code that makes assumptions about every protocol having the same internal structures there. Some protocols don't WANT that sort of structure. (for example the whole idea of a netmask is foreign to appletalk). This needs to be made opaque to the external code. My suggested first change is to add routing method pointers to the 'domain' structure, along with information pointing the data. instead of having an array of pointers to uniform structures, there would be an array pointing to the 'domain' structures for each protocol address domain (protocol family), and the methods this reached would be called. The methods would have an argument that gives FIB number, but the protocol would be free to ignore it. When the ABI can be changed it raises the possibilty of the addition of a fib entry into the "struct route". Currently, the structure contains the sockaddr of the desination, and the resulting fib entry. To make this work fully, one could add a fib number so that given an address and a fib, one can find the third element, the fib entry. Interaction with the ARP layer/ LL layer would need to be revisited as well. Qing Li has been working on this already. This work was sponsored by Ironport Systems/Cisco Reviewed by: several including rwatson, bz and mlair (parts each) Obtained from: Ironport systems/Cisco
* Add an option (compiled out by default)julian2008-04-291-0/+8
| | | | | | | | | to profile outoing packets for a number of mbuf chain related parameters e.g. number of mbufs, wasted space. probably will do with further work later. Reviewed by: various
* Replaced the misleading uses of a historical artefact M_TRYWAIT with M_WAIT.ru2008-03-251-2/+2
| | | | | | | | | | Removed dead code that assumed that M_TRYWAIT can return NULL; it's not true since the advent of MBUMA. Reviewed by: arch There are ongoing disputes as to whether we want to switch to directly using UMA flags M_WAITOK/M_NOWAIT for mbuf(9) allocation.
* o add M_PROTO[678]; they'll be needed by net80211 vap codesam2008-03-241-37/+37
| | | | | | | | | o sort mbuf flags together and extend values to 32 bits o write M_COPYFLAGS in terms of M_PROTOFLAGS o move M_COPYFLAGS and M_PROTOFLAGS up to be together with flag defs Reviewed by: rwatson MFC after: 3 weeks
* Give MEXTADD() another argument to make both void pointers to thephk2008-02-011-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | free function controlable, instead of passing the KVA of the buffer storage as the first argument. Fix all conventional users of the API to pass the KVA of the buffer as the first argument, to make this a no-op commit. Likely break the only non-convetional user of the API, after informing the relevant committer. Update the mbuf(9) manual page, which was already out of sync on this point. Bump __FreeBSD_version to 800016 as there is no way to tell how many arguments a CPP macro needs any other way. This paves the way for giving sendfile(9) a way to wait for the passed storage to have been accessed before returning. This does not affect the memory layout or size of mbufs. Parental oversight by: sam and rwatson. No MFC is anticipated.
* promote ath_defrag to m_collapse (and retire private+unusedsam2008-01-171-0/+1
| | | | | | | m_collapse from cxgb) Reviewed by: pyun, jhb, kmacy MFC after: 2 weeks
* Protect arg in macro M_ASSERTPKTHDR.yongari2008-01-151-1/+1
|
* Fix KASSERT in m_free_fast - the LIST_EMPTY check only applies to packet ↵kmacy2008-01-091-2/+5
| | | | | | headers. In the non packet header case there may be data there.
* Rename "mbuf_jumbo_pagesize" to "mbuf_jumbo_page". It makes it aligned correctlywkoszek2007-12-251-1/+1
| | | | | | | | | within ddb(4) and in the vmstat(8) output. This change requires netstat(8) to be recompiled. Reviewed by: rwatson@ Tested by: make LINT
* This patch adds an M_NOFREE flag which allows one to mark an mbuf askmacy2007-10-061-1/+2
| | | | | | | | | | | | not being independently freeable. This allows one to embed an mbuf in the cluster itself. This confers the benefits of the packet zone on all cluster sizes. Embedded mbufs currently suffer from the same limitation that packet zone mbufs do in that one cannot disconnect them and pass them around independently of the cluster. It would likely be possible to eliminate this limitation in the future by adding a second reference for the mbuf itself. Approved by: re(gnn)
* Allow drivers to free an mbuf without having the mbuf be touched ifkmacy2007-10-061-0/+10
| | | | | | the driver has already freed any attached tags Approved by: re(gnn)
* - Fix address add handling to clear cached routes and source addressesrrs2007-08-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | when peer acks the add in case the routing table changes. - Fix sctp_lower_sosend to send shutdown chunk for mbuf send case when sndlen = 0 and sinfoflag = SCTP_EOF - Fix sctp_lower_sosend for SCTP_ABORT mbuf send case with null data, So that it does not send the "null" data mbuf out and cause it to get freed twice. - Fix so auto-asconf sysctl actually effect the socket's asconf state. - Do not allow SCTP_AUTO_ASCONF option to be used on subset bound sockets. - Memset bug in sctp_output.c (arguments were reversed) submitted found and reported by Dave Jones (davej@codemonkey.org.uk). - PD-API point needs to be invoked >= not just > to conform to socket api draft this fixes sctp_indata.c in the two places need to be >=. - move M_NOTIFICATION to use M_PROTO5. - PEER_ADDR_PARAMS did not fail properly if you specify an address that is not in the association with a valid assoc_id. This meant you got or set the stcb level values instead of the destination you thought you were going to get/set. Now validate if the stcb is non-null and the net is NULL that the sa_family is set and the address is unspecified otherwise return an error. - The thread based iterator could crash if associations were freed at the exact time it was running. rework the worker thread to use the increment/decrement to prevent this and no longer use the markers that the timer based iterator uses. - Fix the memleak in sctp_add_addr_to_vrf() for the case when it is detected that ifa is already pointing to a ifn. - Fix it so that if someone is so insane that they drop the send window below the minimal add mark, they still can send. - Changed all state for associations to use mask safe macro. - During front states in association freeing in sctp_inpcbfree, we had a locking problem where locks were not in place where they should have been. - Free association calls were not testing the return value in sctp_inpcb_free() properly... others should be cast void returns where we don't care about the return value. - If a reference count is held on an assoc, even from the "force free" we should not do the actual free.. but instead let the timer free it. - When we enter sctp_input(), if the SCTP_ASOC_ABOUT_TO_BE_FREED flag is set, we must NOT process the packet but handle it like ootb. This is because while freeing an assoc we release the locks to get all the higher order locks so we can purge all the hash tables. This leaves a hole if a packet comes in just at that point. Now sctp_common_input_processing() will call the ootb code in such a case. - Change MBUF M_NOTIFICATION to use M_PROTO5 (per Sam L). This makes it so we don't have a conflict (I think this is a covertity change). We made this change AFTER some conversation and looking to make sure that M_PROTO5 does not have a problem between SCTP and the 802.11 stuff (which is the only other place its used). - Fixed lock order reversal and missing atomic protection around locked_tcb during association lookup and the 1-2-1 model. - Added debug to source address selection. - V6 output must always do checksum even for loopback. - Remove more locks around inp that are not needed for an atomically added/subtracted ref count. - slight optimization in the way we zero the array in sctp_sack_check() - It was possible to respond to a ABORT() with bad checksum with a PKT-DROP. This lead to a PKT-DROP/ABORT war. Add code to NOT send a PKT-DROP to any ABORT(). - Add an option for local logging (useful for macintosh or when you need better performing during debugging). Note no commands are here to get the log info, you must just use kgdb. - The timer code needs to be aware of if it needs to call sctp_sack_check() to slide the maps and adjust the cum-ack. This is because it may be out of sync cum-ack wise. - Added threshold managment logging. - If the user picked just the right size, that just filled the send window minus one mtu, we would enter a forever loop not copying and at the same time not blocking. Change from < to <= solves this. - Sysctl added to control the fragment interleave level which defaults to 1. - My rwnd control was not being used to control the rwnd properly (we did not add and subtract to it :-() this is now fixed so we handle small messages (1 byte etc) better to bring our rwnd down more slowly. Approved by: re@freebsd.org (Bruce Mah)
* Link pf 4.1 to the build:mlaier2007-07-031-5/+1
| | | | | | | | - move ftp-proxy from libexec to usr.sbin - add tftp-proxy - new altq mtag link Approved by: re (kensmith)
* Back out the previous commit which added an M_LRO mbuf flaggallatin2007-06-111-2/+1
| | | | | to defeat the mtu check in ether_input. Mbuf flags are too scarce. Discussed with: sam
* Allow drivers, such as cxgb and mxge, which support LRO to bypassgallatin2007-06-111-1/+2
| | | | | | the MTU check in ether_input() on LRO merged frames. Discussed with: kmacy
* back out option to disable packet zonekmacy2007-04-151-6/+0
| | | | Requested by: sam
* hide static declarationkmacy2007-04-141-2/+4
| | | | remove extra white space
* Add option for disabling allocation from the packet zonekmacy2007-04-141-0/+4
|
* pad out m_hdr to make pkthdr word-alignedkmacy2007-04-141-1/+8
| | | | | | shuffle pkthdr.len so that pkthdr.header is aligned without compiler added padding Reviewed by: rwatson, andre, sam
* Add m_last() inline function.andre2007-04-111-0/+10
|
* m_extadd does not appear to do the right thing for the case of clusterskmacy2007-04-041-0/+39
| | | | | | allocated from UMA - add m_cljset to correspond to m_cljget MFC after: 3 days
* add helper functions for mapping size to zonez and typeskmacy2007-04-041-37/+63
| | | | eliminate duplicated zone lookup switch statements
* General style cleanup.rwatson2007-03-241-162/+163
| | | | | | | Correct spelling errors. Remove references to M_COPY_PKTHDR -- it was deprecated in 6.x and is not used (or defined) in our tree.
* Introduce a new mbuf flag, M_PROMISC.bms2007-03-011-1/+2
| | | | | | | | | | | | | An mbuf packet chain with the M_PROMISC flag set contains a unicast packet received by the link layer, which does not correspond to any configured link layer address in the local system. It is copied when copying m_pkthdr. It is not cleared when crossing layers. As such, it is defined to have a flag value which is outside of the M_PROTO* range, like M_VLANTAG has. Reviewed by: andre Obtained from: NetBSD
* Fix for problems that occur when all mbuf clusters migrate to the mbuf packetmohans2007-01-251-0/+8
| | | | | | | | | zone. Cluster allocations fail when this happens. Also processes that may have blocked on cluster allocations will never be woken up. Thanks to rwatson for an overview of the issue and pointers to the mbuma paper and his tool to dump out UMA zones. Reviewed by: andre@
* Use tabs instead of spaces.pjd2006-11-141-1/+1
|
* Correct a typo.bz2006-11-141-1/+1
|
* Ok, here it is, we finally add SCTP to current. Note that thisrrs2006-11-031-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | work is not just mine, but it is also the works of Peter Lei and Michael Tuexen. They both are my two key other developers working on the project.. and they need ata-boy's too: **** peterlei@cisco.com tuexen@fh-muenster.de **** I did do a make sysent which updated the syscall's and sysproto.. I hope that is correct... without it you don't build since we have new syscalls for SCTP :-0 So go out and look at the NOTES, add option SCTP (make sure inet and inet6 are present too) and play with SCTP. I will see about comitting some test tools I have after I figure out where I should place them. I also have a lib (libsctp.a) that adds some of the missing socketapi functions that I need to put into lib's.. I will talk to George about this :-) There may still be some 64 bit issues in here, none of us have a 64 bit processor to test with yet.. Michael may have a MAC but thats another beast too.. If you have a mac and want to use SCTP contact Michael he maintains a web site with a loadable module with this code :-) Reviewed by: gnn Approved by: gnn
* Rename m_getm() to m_getm2() and rewrite it to allocate up to page sizedandre2006-11-021-2/+4
| | | | | | | | | | | | | | mbuf clusters. Add a flags parameter to accept M_PKTHDR and M_EOR mbuf chain flags. Provide compatibility macro for m_getm() calling m_getm2() with M_PKTHDR set. Rewrite m_uiotombuf() to use m_getm2() for mbuf allocation and do the uiomove() in a tight loop over the mbuf chain. Add a flags parameter to accept mbuf flags to be passed to m_getm2(). Adjust all callers for the extra parameter. Sponsored by: TCP/IP Optimization Fundraise 2005 MFC after: 3 month
* Update a comment about M_VLANTAG.ru2006-09-221-1/+1
|
* Move ethernet VLAN tags from mtags to its own mbuf packet header fieldandre2006-09-171-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | m_pkthdr.ether_vlan. The presence of the M_VLANTAG flag on the mbuf signifies the presence and validity of its content. Drivers that support hardware VLAN tag stripping fill in the received VLAN tag (containing both vlan and priority information) into the ether_vtag mbuf packet header field: m->m_pkthdr.ether_vtag = vlan_id; /* ntohs()? */ m->m_flags |= M_VLANTAG; to mark the packet m with the specified VLAN tag. On output the driver should check the mbuf for the M_VLANTAG flag to see if a VLAN tag is present and valid: if (m->m_flags & M_VLANTAG) { ... = m->m_pkthdr.ether_vtag; /* htons()? */ ... pass tag to hardware ... } VLAN tags are stored in host byte order. Byte swapping may be necessary. (Note: This driver conversion was mechanic and did not add or remove any byte swapping in the drivers.) Remove zone_mtag_vlan UMA zone and MTAG_VLAN definition. No more tag memory allocation have to be done. Reviewed by: thompsa, yar Sponsored by: TCP/IP Optimization Fundraise 2005
OpenPOWER on IntegriCloud