summaryrefslogtreecommitdiff
path: root/sys/kern/uipc_mbuf.c
AgeCommit message (Collapse)Author
2014-03-28Reduce uvm include madness. Use <uvm/uvm_extern.h> instead ofMartin Pieuchot
<uvm/uvm.h> if possible and remove double inclusions. ok beck@, mlarkin@, deraadt@
2014-03-27Store an ifp index instead of a pointer in the "struct mbuf_ext".Martin Pieuchot
This is part of the plan to remove the ifp pointer from the packet header that will allow us to stop garbage collecting mbuf(9)s when an ifp is detached/destroyed. ok mikeb@, lteo@, benno@
2014-01-19Remove max_datalen. It is only used once an can be replaced easily withClaudio Jeker
MHLEN - max_hdr in that place. OK mikeb@
2014-01-10Let "ddb show mbuf" print all mbuf fields in a consistent way. MoveAlexander Bluhm
bit field names into the header file below the definitions to keep them in sync. OK mikeb@ mpi@
2013-11-09ticks is compared against mcl_grown to see if time has elapsed sinceDavid Gwynne
the rx ring was last allowed to grow and then assigned to it. it is erroneous to do this because mcl_grown is a u_int and ticks is an int. this makes mcl_grown an int, and follows the idiom in kern_timeout.c of going "thing - ticks < diff", which better copes with ticks wrapping around and being used to calculate relative intervals. ok pirofti@ guenther@
2013-08-21get rid of the copy argument in m_devget that let you provide anDavid Gwynne
alternative to bcopy since noone uses it. while there use memcpy instead of bcopy because we know the memory cannot overlap. ok henning@ matthew@ mikeb@ deraadt@
2013-08-08Uncomment kprintf format attributes for sys/kernSylvestre Gallon
tested on vax (gcc3) ok miod@
2013-06-11replace bcopy with memcpy in m_defrag. this is safe because theDavid Gwynne
memory we're copying between is guaranteed to be non-overlapping since the target is newly allocated. ok kettenis@ henning@ tedu@
2013-06-11return ENOBUFS on failure from m_defrag and m_tag_copy_chain.David Gwynne
m_foo functions that return errors are now consistent as far as i can tell. ok bluhm@
2013-03-28do not include machine/cpu.h from a .c file; it is the responsibility ofTheo de Raadt
.h files to pull it in, if needed ok tedu
2013-02-17Comment out recently added __attribute__((__format__(__kprintf__))) annotationsMiod Vallat
in MI code; gcc 2.95 does not accept such annotation for function pointer declarations, only function prototypes. To be uncommented once gcc 2.95 bites the dust.
2013-02-09Add explicit __attribute__ ((__format__(__kprintf__)))) to the functions andMiod Vallat
function pointer arguments which are {used as,} wrappers around the kernel printf function. No functional change.
2013-02-07convert mbuf tags to use pool(9) as a backend storage;Mike Belopuhov
ok markus claudio haesbaert henning
2012-09-26add M_ZEROIZE as an mbuf flag, so copied PFKEY messages (with embedded keys)Markus Friedl
are cleared as well; from hshoexer@, feedback and ok bluhm@, ok claudio@
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@