Age | Commit message (Collapse) | Author |
|
if the packet has the M_TIMESTAMP csum_flag, ph_timestamp is added
to the boottime clock, otherwise it just uses microtime().
|
|
|
|
accomodating allocator. an interrupt safe pool may also be used in process
context, as indicated by waitok flags. thanks to the garbage collector, we
can always free pages in process context. the only complication is where
to put the pages. solve this by saving the allocation flags in the pool
page header so the free function can examine them.
not actually used in this diff. (coming soon.)
arm testing and compile fixes from phessler
|
|
this fixes an issue found by a regress test on sparc64 by claudio,
and between us took about half a day of work to understand and fix
at a2k19.
ok claudio@
|
|
OK millert@ bluhm@
|
|
flag to the other references. Then the final m_free() will clear
the memory.
OK claudio@
|
|
return. Hopefully the other reference holder has the M_ZEROIZE flag set as
well. Triggered by syzkaller. OK deradt@ visa@
Reported-by: syzbot+c578107d70008715d41f@syzkaller.appspotmail.com
|
|
OK bluhm@
|
|
all types of mbufs. Also introduce some KASSERT in the m_*space() functions
to ensure that no negative number is returned. This also introduces two
internal macros M_SIZE() & M_DATABUF() which return the right size and start
pointer of the mbuf data area. Use it in a few obvious places to simplify code.
OK bluhm@
|
|
m_leadingspace() and m_trailingspace(). Convert all callers to call
directly the functions and remove the defines.
OK krw@, mpi@
|
|
start locking the socket. An inp can be referenced by the PCB queue
and hashes, by a pf mbuf header, or by a pf state key.
OK visa@
|
|
put the algorithm into a new function m_calchdrlen(). Also set an
uninitialized m_len to 0 in NFS code.
OK claudio@
|
|
created. Add a new function m_removehdr() do convert packet header
mbufs within the chain to regular mbufs. Assert that the mbuf at
the beginning of the chain has a packet header.
found by Maxime Villard in NetBSD; from markus@; OK claudio@
|
|
Previous commit has no OK's or discussion about testing.
|
|
|
|
previously it took a shortcut when emptying an mbuf by only setting
m_len to 0, but leaving m_data alone. this interacts badly with
m_pullup, which tries to maintain the alignment of the data
payload. if there was a 14 byte ethernet header on its own that was
m_adjed off, and then the stack wants an ip header, m_pullup
would put the ip header on the ethernet header alignment, which is
off by 2 bytes.
found by stsp@ with pair(4) on sparc64.
ok stsp@ too
|
|
ok dlg@
|
|
existing statekey in the mbuf header. Reset the statekey in
m_dup_pkthdr().
suggested by and OK sahan@
|
|
or other states more consistent.
OK visa@ sashan@ on a previous version
|
|
ok visa@, bluhm@, deraadt@
|
|
dereference m if it is NULL. See CID 501458.
- Remove the m NULL check from the final for loop, it is not
necessary. This cannot happen due to the length calculation.
The inconsistent code caused the coverity issue.
- Move the m = mp close to all the loops where the mbuf
chain is traversed.
- Use mp to access the m_pkthdr consistently.
- Move the next assignemnt from for (;;m = m->m_next) to the
end of the loop to make it consistent to the previous for (;;)
where the total length is calculated.
OK visa@ mpi@
|
|
mbuf functions.
OK claudio@
|
|
Still quite complicated but more legible in the end and it will do less
M_GET calls for huge packets.
OK bluhm@
|
|
ok kettenis mpi tom
|
|
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@
|
|
|