summaryrefslogtreecommitdiff
path: root/sys/kern/uipc_mbuf.c
AgeCommit message (Collapse)Author
2012-04-13unneccessary casts to unsigned; ok claudioTheo de Raadt
2011-12-02dont put MAXMCLBYTES in the mclsizes array with a comment saying its 64kDavid Gwynne
when the macro can change without automatically fixing the comment. instead add a diagnostic that checks that the biggest cluster size is always MAXMCLBYTES. requested by and ok kettenis@
2011-11-30this diff introduces the MAXMCLBYTES macro to describe the largestDavid Gwynne
cluster the generic network stack will be able to give you. it also recognises that external storage on an mbuf may be bigger than MCLBYTES. its only when m_pullup or m_pulldown need to allocate another cluster that they now check the len argument, and now they do it against MAXMCLBYTES. this is required for me to do pfsync on jumbo frames as the m_pulldown for the subregions fail beyond MCLBYTES into the packet. ok deraadt@ mikeb@ henning@ blambert@ manpage changes ok jmc@
2011-11-30correctly calculate the space available in external storage in m_pullup.David Gwynne
ok deraadt@ claudio@ blambert@ mikeb@
2011-11-29whitespace fixes. no binary change.David Gwynne
2011-09-18One more %hh format string.Miod Vallat
2011-07-08new priority queueing implementation, extremely low overhead, thus fast.Henning Brauer
unconditional, always on. 8 priority levels, as every better switch, the vlan header etc etc. ok ryan mpf sthen, pea tested as well
2011-07-05Minor cleanup. OK blambert@Claudio Jeker
2011-06-23Make mbufs and dma_alloc be contig allocations.Ariane van der Steldt
Requested by dlg@ ok oga@
2011-05-04Collapse m_pullup and m_pullup2 into a single function, as they'reBret Lambert
essentially identical; the only difference being that m_pullup2 is capable of handling mbuf clusters, but called m_pullup for shorter lengths (!). testing dlg@ ok claudio@
2011-04-18Put back the change of pool and malloc into the new km_alloc(9) api.Artur Grabowski
The problems during the hackathon were not caused by this (most likely). prodded by deraadt@ and beck@
2011-04-11Move the DDB includes up in the file so that the m_print() prototype isClaudio Jeker
defined in all of uipc_mbuf.c. I use this function a lot for quick printf debugging.
2011-04-10Backout m_split_mbuf() from revision 1.150. It seems that m_split()Alexander Bluhm
got broken. Most /usr/src/regress/sys/kern/splice/args-oobinline-* regression tests fail when they split an mbuf at out-of-band data. ok claudio@, deraadt@
2011-04-06Backout the uvm_km_getpage -> km_alloc conversion. Weird things are happeningArtur Grabowski
and we aren't sure what's causing them. shouted oks by many before I even built a kernel with the diff.
2011-04-05Passing M_WAITOK to mbuf functions is supposed to be a contract betweenBret Lambert
the caller and the function that the function will not fail to allocate memory and return a NULL pointer. However, m_dup_pkthdr() violates this contract, making it possible for functions that pass M_WAITOK to be surprised in ways that hurt. Fix this by passing the wait flag all the way down the functions that actually do the allocation for m_dup_pkthdr() so that we won't be surprised. man page update forthcoming ok claudio@
2011-04-05 - Change pool constraints to use kmem_pa_mode instead of uvm_constraint_rangeArtur Grabowski
- Use km_alloc for all backend allocations in pools. - Use km_alloc for the emergmency kentry allocations in uvm_mapent_alloc - Garbage collect uvm_km_getpage, uvm_km_getpage_pla and uvm_km_putpage ariane@ ok
2011-04-04both m_inject() and m_split() reached a point at which they neededBret Lambert
to cleave a single mbuf in twain, but managed to fail in divergent and horrible ways in doing so in anything resembling a sane manner introduce m_split_mbuf() and remake the previous into wrappers around that pounded by phessler@ ok claudio@
2011-01-29The function m_tag_copy_chain() returned 0 on success and 1 onAlexander Bluhm
failure. The man page explained it the other way around. Change the return code to the more obvious 0 or ENOMEM and document this. ok krw@ markus@ miod@ jmc@
2010-12-21Ugly workaround in nmbclust_update(). Additionally to setting the limitClaudio Jeker
also modify the hiwat mark. This was done in pool_sethardlimit() until rev. 1.99. Without this the mbuf cluster pool may return free pages too quickly with the result that m_clget() may fail while populating DMA rings. Seems to fix some hangs seen on MCLGETI() interfaces on i386 e.g. PR 6524. A proper fix is to make all drivers handle empty rings but that will take a while to implement. With and OK mikeb@
2010-11-05Implement m_print as real ddb command "show mbuf addr" in the way otherClaudio Jeker
such commands are implemented. "Ja! You'll need to update ddb.4 as well, of course." miod@
2010-10-28Add m_print() a function to print mbuf headers. Can be called from ddbClaudio Jeker
with an mbuf pointer as argument to see the contents of it. OK thib@, deraadt@
2010-10-05implicitly protect m_cldrop with splnet; ok claudio dlgMike Belopuhov
2010-09-23tweak the mclgeti algorithm to behave better under load.David Gwynne
instead of letting hardware rings grow on every interrupt, restrict it so it can only grow once per softclock tick. we can only punish the rings on softclock ticks, so it make sense to only grow on softclock tick boundaries too. the rings are now punished after >1 lost softclock tick rather than >2. mclgeti is now more aggressive at detecting livelock. the rings get punished by an 8th, rather than by half. we now allow the rings to be punished again even if the system is already considered in livelock. without this diff a livelocked system will have its rx ring sizes scale up and down very rapidly, while holding the rings low for too long. this affected throughput significantly. discussed and tested heavily at j2k10. there are still some games with softnet we can play, but this is a good first step. "put it in" and ok deraadt@ ok claudio@ krw@ henning@ mcbride@ if we find out that it sucks we can pull it out again later. till then we'll run with it and see how it goes.
2010-07-15m_getptr(m, 0, ...) may return an mbuf different from m -- if m has noClaudio Jeker
data in it. m_getptr() hops over empty buffers and points to the first allocated data byte. Because of this the m_dup_pkthdr() call done by m_copym0() can panic because not the first mbuf is passed. Found the hard way by myself, diff by blambert@ commiitting for him since he is not around. Tested and OK myself
2010-07-14Eliminate some unused malloc(9) type defines. Also get rid of theMatthew Dempsky
mysterious and unused mbtypes[] array in mbuf.h. ok tedu@, deraadt@
2010-07-03replace 0 with equivalent allocation flag. ok thibTed Unangst
2010-07-02m_copyback can fail to allocate memory, but is a void fucntion so gymnasticsBret Lambert
are required to detect that. Change the function to take a wait argument (used in nfs server, but M_NOWAIT everywhere else for now) and to return an error ok claudio@ henning@ krw@
2010-07-01pool setconstraints must be called immediately after pool_init, otherwiseBob Beck
if we allocate memory before applying constraints we get memory outside the constraints allocated in the pool. this is bad. ok claudio@
2010-06-27uvm constraints. Add two mandatory MD symbols, uvm_md_constraintsThordur I. Bjornsson
which contains the constraints for DMA/memory allocation for each architecture, and dma_constraints which contains the range of addresses that are dma accessable by the system. This is based on ariane@'s physcontig diff, with lots of bugfixes and additions the following additions by my self: Introduce a new function pool_set_constraints() which sets the address range for which we allocate pages for the pool from, this is now used for the mbuf/mbuf cluster pools to keep them dma accessible. The !direct archs no longer stuff pages into the kernel object in uvm_km_getpage_pla but rather do a pmap_extract() in uvm_km_putpages. Tested heavily by my self on i386, amd64 and sparc64. Some tests on alpha and SGI. "commit it" beck, art, oga, deraadt "i like the diff" deraadt
2010-06-07Replace some handrolled instances of m_getptr() with that function, whichBret Lambert
also gets a bit of a KNF scrubbing at claudio@'s insistence. Shaves some bytes from the kernel as well. tested by phessler@ and zinovnik@, thanks ok claudio@
2010-01-14fix typos in comments, no code changes;Ingo Schwarze
from Brad Tilley <brad at 16systems dot com>; ok oga@
2010-01-12Move initialization of the MCLGETI ticker to mbinit(), instead of ifinit()Theo de Raadt
ok henning
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