summaryrefslogtreecommitdiff
path: root/sys/kern/uipc_mbuf.c
AgeCommit message (Collapse)Author
2009-09-13M_DUP_PKTHDR() define -> m_dup_pkthdr() function to properly dealKenneth R Westerback
with m_tag_copy_chain() failures. Use m_defrag() to eliminate hand rolled defragging of mbufs and some uses of M_DUP_PKTHDR(). Original diff from thib@, claudio@'s feedback integrated by me. Tests kevlo@ claudio@, "reads ok" blambert@ ok thib@ claudio@, "m_defrag() bits ok" kettenis@
2009-08-12just bzero the pkthdr instead of setting each and every member of thatHenning Brauer
struct to 0/NULL. no performance impact but way less error prone on addition of new pkthdr field (as just ran into with a theo diff). ok theo
2009-08-12revert my change to m_cluncount which tries to prevent the systemDavid Gwynne
running out of mbufs for rx rings. if the system low watermark is lower than a rx rings low watermark, we'll never send a packet up the stack, we'll always recycle it. found by thib@ on a bge sadface
2009-08-12if we get dangerously low on clusters during interrupts, we needDavid Gwynne
to free some for use on the rx rings on network cards. this modifies m_cluncount to advise callers when we're in such a situation, and makes them responsible for freeing up the cluster for allocation by MCLGETI later. fixes an awesome lockup with sis(4) henning has been experiencing. this is not the best fix, but it is better than the current situation. yep deraadt@ tested by henning@
2009-08-11optimise m_clget so that it holds spl for even lessTheo de Raadt
ok dlg thib
2009-08-11Must move the splx() lower in m_clget() so that it protects atomic accessTheo de Raadt
to the per-ipf mbuf cluster reference counters ok dlg claudio
2009-08-09remove the ancient MCFail / MPFail debugging technique; ok claudioTheo de Raadt
2009-08-09use m_free_unlocked() in m_pullup() to avoid iterative splnet/splx downTheo de Raadt
the chain ok henning
2009-08-09make mbuf tags suck a bit less, performance wise.Henning Brauer
the most common operation is checking for a particular tag to be there. in the majority of the cases it is not. introduce a "tagsset" in the mbuf packet header which has a bit for each mbuf tag type that is in the chain set, checking for its existance is now as easy and cheap as (tagsset & type) != 0. theo ok
2009-08-09create a m_free_unlocked which is now used by both m_freem() and m_free().Theo de Raadt
this lets m_freem() only do one splnet/splx instead of repeating this all the way down a chain ok henning claudio dlg
2009-08-09do not clear a field before we pool_put it into oblivion; ok henningTheo de Raadt
2009-08-09MCLGETI() will now allocate a mbuf header if it is not provided, thusTheo de Raadt
reducing the amount of splnet/splx dancing required.. especially in the worst case (of m_cldrop) ok dlg kettenis damien
2009-06-22sync m_inithdr() with m_gethdr() after theThordur I. Bjornsson
addition of rdomain to struct pkthdr. "Doh!" claudio@ ok henning@
2009-06-05Initial support for routing domains. This allows to bind interfaces toClaudio Jeker
alternate routing table and separate them from other interfaces in distinct routing tables. The same network can now be used in any doamin at the same time without causing conflicts. This diff is mostly mechanical and adds the necessary rdomain checks accross net and netinet. L2 and IPv4 are mostly covered still missing pf and IPv6. input and tested by jsg@, phessler@ and reyk@. "put it in" deraadt@
2009-06-02Move M_PREPEND macro code to be entirely into m_prepend the function;Bret Lambert
calling M_PREPEND is now #define'd to be calling m_prepend. Shaves an unknown but assumed-to-be-nontrivial amount from the kernel. ok claudio@ henning@(who may have had to okay this twice to get me to notice)
2009-03-02the packet length passed to m_clget is a u_int, print it with %u not %d inDavid Gwynne
the panic string.
2009-02-09Don't panic if m_copyback() is working on a M_READONLY() mbuf. The old versionClaudio Jeker
did not care either and with this packets from drivers with external buffers (e.g. wpi(4)) would trigger this panic through pf(4). Found the hard way by Tim van der Molen tbvdm (at) xs4all (dot) nl
2009-02-04Make m_copyback() a lot smarter. Make it use all of the last mbufClaudio Jeker
(M_TRAILINGSPACE()) and allocate one cluster if needed (instead of chaining many mbufs). Somewhat needed for the rl(4) fix to ensure that the ethernet header is in one mbuf for sure. Tested by landry@ and myself
2009-01-27make drivers tell the mclgeti allocator what their maximum ring size isDavid Gwynne
to prevent the hwm growing beyond that. this allows the livelock mitigation to do something where the hwm used to grow beyond twice the rx rings size. ok kettenis@ claudio@
2009-01-26Remove unneeded brackets that where left over from when these were macros.Claudio Jeker
OK dlg@
2008-12-23The splvm() protection is way outdated, only splnet is needed to protectTheo de Raadt
this pool (and the mbstat variables, and a few other things in certain cases) ok mikeb, tedu, and discussion with others...
2008-12-22Doh. Correct address in bcopy -- m->m_data not &m->m_data -- this should fixClaudio Jeker
the issues seen by damien@. OK dlg@, damien@
2008-12-20protect mbstat with spl; ok claudio mikebTheo de Raadt
2008-12-14Make sure the low water mark for cluster pools isn't 0 such that networkMark Kettenis
drivers are guaranteed to make progress. We could probably set it to 1, but we set it to 2, to make sure drivers that link descriptors don't link a descriptor back to itself. ok deraadt@, dlg@
2008-12-13note to everyone: nitems(pointer) is 0, not what you wantTheo de Raadt
2008-12-11export per-interface mbuf cluster pool use statistics out to userlandTheo de Raadt
inside if_data, so that netstat(1) and systat(1) can see them ok dlg
2008-12-04enable to large clusters again now that arts put the pool allocator forDavid Gwynne
them in again.
2008-11-29need splvm() around the call to m_extfree() in the defraggerTheo de Raadt
2008-11-26Doh, do not commit before compile. Found by sthen@Claudio Jeker
2008-11-26Do a quick return if m->m_next is NULL in m_defrag() because there is nothingClaudio Jeker
todo. Discussed with deraadt@ and dlg@
2008-11-26only the pool_get() needs to be spl protected; ok claudio dlgTheo de Raadt
2008-11-25m_defrag() a mbuf chain defragmenter. It will collaps a mbuf chain into aClaudio Jeker
single buffer without changing the head mbuf. This is done with a lot of magic so there will be dragons. Tested and OK dlg@, kettenis@
2008-11-25backout large cluster allocators.David Gwynne
2008-11-25art says he doesnt suck anymore, so enable the really big clusterDavid Gwynne
allocators again.
2008-11-25Factor increases are not needed, +1 appears to work as well.Theo de Raadt
ok dlg
2008-11-25m_cluncount() needs to walk the mbuf chain to correctly uncount all clustersClaudio Jeker
but don't do that in m_free() as that will cause a double loop behaviour when called via m_freem(). OK dlg@, deraadt@
2008-11-24art isnt handling spls properly in the pool allocator backends for bigDavid Gwynne
objects. dmesg is being spammed with splasserts. disable the 8k, 9k, 12k, 16k, and 64k backend pools for the cluster allocator. art will fix this when he gets back from dinner, otherwise i'll nag more.
2008-11-24enable the 8k, 9k, 12k, 16k, and 64k backend pools for the clusterDavid Gwynne
allocator.
2008-11-24move MCLPOOLS to if.h and force uipc_mbuf.c to get if.h, there is noTheo de Raadt
other option ok dlg
2008-11-24add several backend pools to allocate mbufs clusters of various sizes outDavid Gwynne
of. currently limited to MCLBYTES (2048 bytes) and 4096 bytes until pools can allocate objects of sizes greater than PAGESIZE. this allows drivers to ask for "jumbo" packets to fill rx rings with. the second half of this change is per interface mbuf cluster allocator statistics. drivers can use the new interface (MCLGETI), which will use these stats to selectively fail allocations based on demand for mbufs. if the driver isnt rapidly consuming rx mbufs, we dont allow it to allocate many to put on its rx ring. drivers require modifications to take advantage of both the new allocation semantic and large clusters. this was written and developed with deraadt@ over the last two days ok deraadt@ claudio@
2008-10-14Change m_devget()'s outdated and unused "offset" argument: It isChristian Weisgerber
now the offset into the first mbuf of the target chain before copying the source data over. From FreeBSD. Convert drivers' use of m_devget(). Mostly from thib@. Update mbuf(9) man page. ok claudio@, thib@
2008-09-28initialize the ether_vtag field like the rest of the packet headerChristian Weisgerber
2008-08-14Kill the _MCLDEREFERENCE() macro it was only used once and it should be onlyClaudio Jeker
used once -- in m_free(). Removed so that people don't get stupid ideas. OK thib@
2008-08-08plug an mbuf leak in m_pullup2(); If we fail to get a cluster for an mbuf,Thordur I. Bjornsson
free the mbuf before bailing out. ok claudio@
2008-06-11store a pointer to the stack side state key in the mbuf packetHenning Brauer
header inbound. on the outbound side, we take that and look for the key that is the exact opposite, and store that mapping in the state key. on subsequent packets we don't have to do the lookup on outbound any more. almost unable to get real benchmarks going here, we know for sure this gives a more than 5% increase in forwarding performance. many thanks to ckuethe for stress- and performance-testing. ok ryan theo
2008-05-06Rather than clearing particularly dangerous flags when found, justKenneth R Westerback
zero all flags when we pool_put mbufs. ok claudio@ henning@
2008-01-16Dont use PR_LIMITFAIL with PR_WAITOK when M_WAIT is passed withThordur I. Bjornsson
the flag argument to the m_*get* functions. Since PR_LIMITFAIL can cause us to return NULL if hit the limits. ok claudio@
2007-11-27make the deceptively complicated leading and trailing space into functions.Ted Unangst
this reduces kernel size quite a bit. ok claudio
2007-09-26provide m_inithdr(), which takes an mbuf and gives an initialized M_PKTHDRHenning Brauer
mbuf back. for fixing PR5563 in a few, tested janjaap@stack.nl, ok claudio
2007-07-20Remove the MFREE() macro and replace it with a call to m_free().Claudio Jeker
Also remove the _MEXTREMOVE macro which was only used by MFREE. This time with the uipc_mbuf.c change that I missed last time.