Age | Commit message (Collapse) | Author |
|
this didnt make sense previously since the mbuf pools had item
limits that meant the cpus had to coordinate via a single counter
to make sure the limit wasnt exceeded.
mbufs are now limited by how much memory can be allocated for pages
from the system. individual pool items are no longer counted and
therefore do not have to be coordinated.
ok bluhm@ as part of a larger diff.
|
|
this replaces individual calls to pool_init, pool_set_constraints, and
pool_sethardlimit with calls to m_pool_init. m_pool_init inits the
mbuf pools with the mbuf pool allocator, and because of that doesnt
set per pool limits.
ok bluhm@ as part of a larger diff
|
|
m_pool_init is basically a call to pool_init with everythign except
the size and alignment specified, and a call to pool_set_constraints
so the memroy is always dma reachable. it also wires up the memory
with the custom mbuf pool allocator.
ok bluhm@ as part of a larger diff
|
|
the custom allocator is basically a wrapper around the multi page
pool allocator, but it has a single global memory limit managed by
the wrapper.
currently each of the mbuf pools has their own memory limit (or
none in the case of the myx pool) independent of the other pools.
this means each pool can allocate up to nmbclust worth of mbufs,
rather than all of them sharing the one limit. wrapping the allocator
like this means we can move to a single memory limit for all mbufs
in the system.
ok bluhm@ as part of a larger diff
|
|
This makes the API simpler, and is probably more useful than spreading
counters memory other several types, making it harder to track.
Prodded by mpi, ok mpi@ stsp@
|
|
a mbuf and properly intialize m_len.
From FreeBSD via Imre Vadasz.
ok bluhm@
|
|
NULL tests.
ok mpi@
|
|
Fix a typo introduced in m_pullup(9) refactoring and found the hard
way by semarie@ while testing another diff.
ok mikeb@, dlg@
|
|
the most important change is that if the requested data is already
in the first mbuf in the chain, return quickly.
if that isnt true, the code will try to use the first mbuf to fit
the requested data.
if that isnt true, it will prepend an mbuf, and maybe a cluster,
to fit the requested data.
m_pullup will now try to maintain the alignment of the original
payload, even when prepending a new mbuf for it.
ok mikeb@
|
|
a certain vendor likes to make chips that specify the rx buffer
sizes in kilobyte increments. unfortunately it places the ethernet
header on the start of the rx buffer, which means if you give it a
mcl2k cluster, the ethernet header will not be ETHER_ALIGNed cos
mcl2k clusters are always allocated on 2k boundarys (cos they pack
into pages well). that in turn means the ip header wont be aligned
correctly.
the current workaround on these chips has been to let non-strict
alignment archs just use the normal 2k cluster, but use whatever
cluster can fit 2k + 2 on strict archs. that turns out to be the
4k cluster, meaning we waste nearly 2k of space on every packet.
properly aligning the ethernet header and ip headers gives a
performance boost, even on non-strict archs.
|
|
cpumem_realloc and counters_realloc actually allocated new per cpu data
for new cpus, they didnt resize the existing allocation.
specifically, this renames cpumem_reallod to cpumem_malloc_ncpus, and
counters_realloc to counters_alloc_ncpus.
ok (and with some fixes by) bluhm@
|
|
each cpus counters still have to be protected by splnet, but this
is better thana single set of counters protected by a global mutex.
ok bluhm@
|
|
no functional change
|
|
this is cheap since it is basic math. it also means that payloads
which have been aligned carefully will also be aligned in their
copy.
ok yasuoka@ claudio@
|
|
the ioff argument to pool_init() is unused and has been for many
years, so this replaces it with an ipl argument. because the ipl
will be set on init we no longer need pool_setipl.
most of these changes have been done with coccinelle using the spatch
below. cocci sucks at formatting code though, so i fixed that by hand.
the manpage and subr_pool.c bits i did myself.
ok tedu@ jmatthew@
@ipl@
expression pp;
expression ipl;
expression s, a, o, f, m, p;
@@
-pool_init(pp, s, a, o, f, m, p);
-pool_setipl(pp, ipl);
+pool_init(pp, s, a, ipl, f, m, p);
|
|
cos m_copym only does shallow copies, we can make the code do them
unconditionally.
for millert@
|
|
ok millert@ mpi@ henning@ claudio@ markus@
|
|
with m_makespace(4) from freebsd; ok mpi@, bluhm@, mikeb@, dlg@
|
|
by number would allow the large clusters using too much memory.
Set size of mclsizes array explicitly to keep it in sync with
mclpools.
OK claudio@
|
|
After writing data into this loop, it was spinning forever causing
a kernel hang. Detect the loop by counting how often the same mbuf
is spliced. If that happens 128 times, assume that there is a loop
and abort the splicing with ELOOP.
Bug found by tedu@; OK tedu@ millert@ benno@
|
|
via unions, and we don't want to make it easy to control the target.
instead an integer index into an array of acceptable functions is used.
drivers using custom functions must register them to receive an index.
ok deraadt
|
|
theyre currently unused, so no functional change.
|
|
this tweaks m_freem so it returns the m_nextpkt from the mbuf it freed,
like how m_free returns the m_next from the mbuf it frees.
ok mpi@
|
|
|
|
this is the second attempt to get it in, the first
attempt got backed out on Jan 31 2016
the change also contains fixes contributed by Stefan Kempf
in earlier iteration.
OK srhen@
|
|
|
|
if a physical interface receives a multicast/broadcast packet and
has carp interfaces on it, that packet needs to be copied for
reception by each of those carp interfaces.
previously it was using m_copym2, but that doesn't respect the
alignment of the source packet. this meant the ip header in the
copies were aligned incorrectly for the network stack, which breaks
strict alignment archs.
m_dup_pkt lets carp specify that the payload needs an ETHER_ALIGN
adjustment, so the ip header inside will be aligned correctly.
reported and tested by anthony eden who hit this on armv7
i reproduced the problem on sparc64 and verified the fix on amd64
and sparc64
ok mpi@ mikeb@ deraadt@
|
|
OK sthen@
|
|
- yet another tiny step towards MP PF. This time we need to make sure
statekey attached to packet stays around, while accepted packet is
routed through IP stack.
this time I'm also bringing fix contributed by Stefan Kempf. Stefan's fix
makes sure we grab reference in m_dup_pkthdr()
OK bluhm@
|
|
----------------------------------------------------------------------
revision 1.961
date: 2015/12/22 13:33:26; author: sashan; state: Exp; lines: +153 -44;
commitid: oBRhtWcDV0ThviVT;
- yet another tiny step towards MP PF. This time we need to make sure
statekey attached to packet stays around, while accepted packet is
routed through IP stack.
OK mpi@, henning@
----------------------------------------------------------------------
there have been multiple reports of KASSERT(!pf_state_key_isvalid(sk)) being
triggered without much effort, so back this out for now.
|
|
statekey attached to packet stays around, while accepted packet is
routed through IP stack.
OK mpi@, henning@
|
|
As Kenjiro Cho pointed out it is very hard to cancel a dequeue operation
for some queueing disciplines when such it keeps some internal states.
As you can see, APIs can also Live Fast & Die Young.
ok dlg@
|
|
ok dlg@
|
|
ok dlg@
|
|
these are modelled on IF_PURGE or IFQ_PURGE. they m_freem all the
mbufs on an mbuf list or queue.
ok jmatthew@ mpi@
|
|
pf part. This allows to reuse this function in socket splicing.
Reset the mbuf flags that are related to the packet header, but
preserve the data flags.
pair(4) tested by reyk@; sosplice(9) tested by bluhm@; OK mikeb@ reyk@
|
|
Start using it in pair(4) to clear state on the receiving interface;
m_resethdr() will also be used in other parts of the stack.
OK bluhm@ mikeb@
|
|
|
|
ok mpi@ claudio@
|
|
calling code simpler.
ok stsp mpi
|
|
receiving interface in the packet header of every mbuf.
The interface pointer should now be retrieved when necessary with
if_get(). If a NULL pointer is returned by if_get(), the interface
has probably been destroy/removed and the mbuf should be freed.
Such mechanism will simplify garbage collection of mbufs and limit
problems with dangling ifp pointers.
Tested by jmatthew@ and krw@, discussed with many.
ok mikeb@, bluhm@, dlg@
|
|
list after transferring all elements away. Reorder the conditionals
to make sure that ml_init() is always called for a non empty second
list. This makes all cases consistent and is less surprising.
OK dlg@
|
|
there's no need to do it in m_devget(9).
Stop passing an ``ifp'' will help for upcoming interface pointer -> index
conversion.
While here remove unused ``ifp'' argument from m_clget(9) and kill two
birds^W layer violations in one commit.
ok henning@
|
|
have any direct symbols used. Tested for indirect use by compiling
amd64/i386/sparc64 kernels.
ok tedu@ deraadt@
|
|
ok mpi@ claudio@ henning@ and more at s2k15
|
|
this lets you run a filter function against each mbuf on a list or
queue. if the filter matches on an mbuf, it can return non-zero to
have ml_filter or mq_filter remove the mbuf and return it as part
of a chain of mbufs.
ok mpi@ claudio@ henning@ and s2k15 generally.
|
|
|
|
isnt descriptive enough for me.
ok deraadt@
|
|
coordinate with other mbufs so you can add all the pointers without
taking the extref lock.
looks good deraadt@
|
|
snuck in.
someone who knows how cpp/cc works can explain to me why this
compiled.
|